mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-29 04:21:39 -04:00
6
.changeset/tangy-taxes-turn.md
Normal file
6
.changeset/tangy-taxes-turn.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/git-resolver": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Fixed the problem of path loss caused by parsing URL address. Fixes a regression shipped in pnpm v10.11 via [#9502](https://github.com/pnpm/pnpm/pull/9502).
|
||||
@@ -177,12 +177,12 @@ function correctUrl (gitUrl: string): string {
|
||||
hash = _gitUrl.slice(hashIndex)
|
||||
_gitUrl = _gitUrl.slice(0, hashIndex)
|
||||
}
|
||||
const [auth, pathname] = _gitUrl.slice(6).split('/')
|
||||
const [auth, ...pathname] = _gitUrl.slice(6).split('/')
|
||||
const [, host] = auth.split('@')
|
||||
if (host.includes(':') && !/:\d+$/.test(host)) {
|
||||
const authArr = auth.split(':')
|
||||
const protocol = gitUrl.split('://')[0]
|
||||
gitUrl = `${protocol}://${authArr.slice(0, -1).join(':') + '/' + authArr[authArr.length - 1]}${pathname ? '/' + pathname : ''}${hash}`
|
||||
gitUrl = `${protocol}://${authArr.slice(0, -1).join(':') + '/' + authArr[authArr.length - 1]}${pathname.length ? '/' + pathname.join('/') : ''}${hash}`
|
||||
}
|
||||
}
|
||||
return gitUrl
|
||||
|
||||
@@ -47,6 +47,7 @@ test.each([
|
||||
|
||||
test.each([
|
||||
['git+https://github.com/pnpm/pnpm.git', 'https://github.com/pnpm/pnpm.git'],
|
||||
['git+ssh://git@sub.domain.tld:internal-app/sub-path/service-name.git', 'ssh://git@sub.domain.tld/internal-app/sub-path/service-name.git'],
|
||||
])('the fetchSpec of %s should be %s', async (input, output) => {
|
||||
const parsed = await parseBareSpecifier(input, {})
|
||||
expect(parsed?.fetchSpec).toBe(output)
|
||||
|
||||
Reference in New Issue
Block a user