MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / constructRepositoryUrl

Function constructRepositoryUrl

src/utils/utils.ts:322–341  ·  view source on GitHub ↗
(
  provider: Provider,
  repositoryName: string,
  host?: string | null,
)

Source from the content-addressed store, hash-verified

320 * constructRepositoryUrl("azure_devops", "org/Web Apps/repo") // "https://dev.azure.com/org/Web%20Apps/_git/repo"
321 */
322export const constructRepositoryUrl = (
323 provider: Provider,
324 repositoryName: string,
325 host?: string | null,
326): string => {
327 const baseUrl = getGitProviderBaseUrl(provider, host);
328 if (provider === "bitbucket_data_center") {
329 const [project, repo] = repositoryName.split("/").map(encodePathSegment);
330 return `${baseUrl}/projects/${project}/repos/${repo}`;
331 }
332 if (provider === "azure_devops") {
333 // Azure DevOps format: org/project/repo
334 const parts = repositoryName.split("/");
335 if (parts.length === 3) {
336 const [org, project, repo] = parts.map(encodePathSegment);
337 return `${baseUrl}/${org}/${project}/_git/${repo}`;
338 }
339 }
340 return `${baseUrl}/${encodeRepositoryPath(repositoryName)}`;
341};
342
343/**
344 * Percent-encode a branch name for use as a URL path component. Each

Callers 4

GitControlBarRepoButtonFunction · 0.90
browseUrlForFunction · 0.90

Calls 2

getGitProviderBaseUrlFunction · 0.85
encodeRepositoryPathFunction · 0.85

Tested by

no test coverage detected