diff --git a/.changeset/chatty-vans-cross.md b/.changeset/chatty-vans-cross.md new file mode 100644 index 0000000000..fab7af5155 --- /dev/null +++ b/.changeset/chatty-vans-cross.md @@ -0,0 +1,5 @@ +--- +'@backstage/integration': patch +--- + +Fixed an issue with resolution of SCM URLs against a base URL with a trailing slash. diff --git a/packages/integration/src/helpers.ts b/packages/integration/src/helpers.ts index 94aafaa6c3..b403155cc5 100644 --- a/packages/integration/src/helpers.ts +++ b/packages/integration/src/helpers.ts @@ -84,8 +84,10 @@ export function defaultScmResolveUrl(options: { if (url.startsWith('/')) { // If it is an absolute path, move relative to the repo root - const { filepath } = parseGitUrl(base); - updated = new URL(base); + const { href, filepath } = parseGitUrl(base); + + updated = new URL(href); + const repoRootPath = trimEnd( updated.pathname.substring(0, updated.pathname.length - filepath.length), '/',