fix: normalize gitlab remote path suffixes (#4277)

This commit is contained in:
Neil
2026-05-31 10:48:43 -07:00
committed by GitHub
parent a7e8471bf2
commit eb7c9fac2d
2 changed files with 12 additions and 1 deletions
+11
View File
@@ -93,6 +93,17 @@ describe('gitlab project ref parsing', () => {
})
})
it('strips trailing slashes after .git suffixes', () => {
expect(parseGitLabProjectRef('https://gitlab.com/acme/widgets.git/')).toEqual({
host: 'gitlab.com',
path: 'acme/widgets'
})
expect(parseGitLabProjectRef('ssh://git@gitlab.com/acme/widgets.git/')).toEqual({
host: 'gitlab.com',
path: 'acme/widgets'
})
})
it('preserves git protocol remote support', () => {
expect(parseGitLabProjectRef('git://gitlab.com/acme/widgets.git')).toEqual({
host: 'gitlab.com',
+1 -1
View File
@@ -138,7 +138,7 @@ function normalizeHost(value: string): string {
}
function stripGitSuffix(path: string): string {
return path.replace(/\.git$/i, '')
return path.replace(/\/+$/, '').replace(/\.git$/i, '')
}
function makeProjectRef(