Skip to content

Commit

Permalink
fix path with leading colon (#1430)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacktuck authored Jul 16, 2024
1 parent 6e6f3c0 commit 2672b13
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/package-managers/gitTags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ const getSortedVersions = async (name: string, declaration: VersionSpec, options
const protocolKnown = protocol != null
if (protocolKnown) {
tagsPromise = tagsPromise.then(() =>
remoteGitTags(`${protocol ? protocol.replace('git+', '') : 'https:'}//${auth ? auth + '@' : ''}${host}/${path}`),
remoteGitTags(
`${protocol ? protocol.replace('git+', '') : 'https:'}//${auth ? auth + '@' : ''}${host}/${path?.replace(/^:/, '')}`,
),
)
} else {
// try ssh first, then https on failure
tagsPromise = tagsPromise
.then(() => remoteGitTags(`ssh://git@${host}/${path}`))
.catch(() => remoteGitTags(`https://${auth ? auth + '@' : ''}${host}/${path}`))
.catch(() => remoteGitTags(`https://${auth ? auth + '@' : ''}${host}/${path?.replace(/^:/, '')}`))
}

// fetch remote tags
Expand Down

0 comments on commit 2672b13

Please sign in to comment.