Merge pull request #12688 from OpenSourceZombie/ahmed/fix-edge-case

Fix replacing hosted gitlab relative path in repo url.
This commit is contained in:
Ben Lambert
2022-07-18 13:20:37 +02:00
committed by GitHub
2 changed files with 10 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/backend-common': patch
---
Fix edge case bug when gitlab relativePath is repeated in the target URL.
@@ -125,8 +125,12 @@ export class GitlabUrlReader implements UrlReader {
);
// Considering self hosted gitlab with relative
// assuming '/gitlab' is the relative path
// from: /gitlab/repo/project
// to: repo/project
if (relativePath) {
repoFullName = trimStart(full_name, relativePath);
const rectifiedRelativePath = `${trimStart(relativePath, '/')}/`;
repoFullName = full_name.replace(rectifiedRelativePath, '');
}
// Use GitLab API to get the default branch