Skip to content

Commit df86b73

Browse files
cursoragentmsukkari
andcommitted
Fix double slash in GitLab and Azure DevOps web URLs
When users configure a GitLab or Azure DevOps connection with a trailing slash in the URL (e.g., https://gitlab.example.com/), the constructed project URLs would have a double slash (https://gitlab.example.com//path) causing 404 errors when opening links. This fix strips trailing slashes from the hostUrl before constructing URLs. Fixes SOU-533 Co-authored-by: Michael Sukkarieh <msukkari@users.noreply.github.com>
1 parent b274daf commit df86b73

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/backend/src/repoCompileUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export const compileGitlabConfig = async (
160160
const gitlabRepos = gitlabReposResult.repos;
161161
const warnings = gitlabReposResult.warnings;
162162

163-
const hostUrl = config.url ?? 'https://gitlab.com';
163+
const hostUrl = (config.url ?? 'https://gitlab.com').replace(/\/$/, '');
164164
const repoNameRoot = new URL(hostUrl)
165165
.toString()
166166
.replace(/^https?:\/\//, '');
@@ -724,7 +724,7 @@ export const compileAzureDevOpsConfig = async (
724724
const azureDevOpsRepos = azureDevOpsReposResult.repos;
725725
const warnings = azureDevOpsReposResult.warnings;
726726

727-
const hostUrl = config.url ?? 'https://dev.azure.com';
727+
const hostUrl = (config.url ?? 'https://dev.azure.com').replace(/\/$/, '');
728728
const repoNameRoot = new URL(hostUrl)
729729
.toString()
730730
.replace(/^https?:\/\//, '');

0 commit comments

Comments
 (0)