File tree Expand file tree Collapse file tree 2 files changed +63
-58
lines changed Expand file tree Collapse file tree 2 files changed +63
-58
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ function protocolToRepresentation (protocol) {
17
17
}
18
18
19
19
function lastIndexOfBefore ( str , char , beforeChar ) {
20
- const startPosition = str . lastIndexOf ( beforeChar )
20
+ const startPosition = str . indexOf ( beforeChar )
21
21
return str . lastIndexOf ( char , startPosition > - 1 ? startPosition : Infinity )
22
22
}
23
23
@@ -193,7 +193,9 @@ const isGitHubShorthand = (arg) => {
193
193
194
194
// attempt to correct an scp style url so that it will parse with `new URL()`
195
195
const correctUrl = ( giturl ) => {
196
- const firstAt = giturl . indexOf ( '@' )
196
+ // ignore @ that come after the first hash since the denotes the start
197
+ // of a committish which can contain @ characters
198
+ const firstAt = lastIndexOfBefore ( giturl , '@' , '#' )
197
199
// ignore colons that come after the hash since that could include colons such as:
198
200
// git@github .com:user/package-2#semver:^1.0.0
199
201
const lastColonBeforeHash = lastIndexOfBefore ( giturl , ':' , '#' )
You can’t perform that action at this time.
0 commit comments