Merge pull request #12688 from OpenSourceZombie/ahmed/fix-edge-case
Fix replacing hosted gitlab relative path in repo url.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user