From 1379080c92b0d22c7df15cf71095b35fe0f89865 Mon Sep 17 00:00:00 2001 From: ahmed Date: Thu, 14 Jul 2022 17:03:15 +0200 Subject: [PATCH 1/3] fix relative path edge case Signed-off-by: ahmed --- packages/backend-common/src/reading/GitlabUrlReader.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/backend-common/src/reading/GitlabUrlReader.ts b/packages/backend-common/src/reading/GitlabUrlReader.ts index 5bc234daef..eaa15a7208 100644 --- a/packages/backend-common/src/reading/GitlabUrlReader.ts +++ b/packages/backend-common/src/reading/GitlabUrlReader.ts @@ -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 From 1f75dfac29831e99382455aacf83af390defc1b2 Mon Sep 17 00:00:00 2001 From: ahmed Date: Thu, 14 Jul 2022 17:05:57 +0200 Subject: [PATCH 2/3] add changest Signed-off-by: ahmed --- .changeset/hot-cooks-enjoy.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/hot-cooks-enjoy.md diff --git a/.changeset/hot-cooks-enjoy.md b/.changeset/hot-cooks-enjoy.md new file mode 100644 index 0000000000..503809fe61 --- /dev/null +++ b/.changeset/hot-cooks-enjoy.md @@ -0,0 +1,5 @@ +--- +'@backstage/backend-common': minor +--- + +Fix edge case bug when gitlab relativePath is repeated in the target URL. From 7a3a9f009d7dc8ff41264960f8c73f63b8089d9c Mon Sep 17 00:00:00 2001 From: ahmed Date: Mon, 18 Jul 2022 12:44:45 +0200 Subject: [PATCH 3/3] patch to fix a bug not minor change Signed-off-by: ahmed --- .changeset/hot-cooks-enjoy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/hot-cooks-enjoy.md b/.changeset/hot-cooks-enjoy.md index 503809fe61..3b7e86505c 100644 --- a/.changeset/hot-cooks-enjoy.md +++ b/.changeset/hot-cooks-enjoy.md @@ -1,5 +1,5 @@ --- -'@backstage/backend-common': minor +'@backstage/backend-common': patch --- Fix edge case bug when gitlab relativePath is repeated in the target URL.