File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed
Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,11 @@ const correctProtocol = (arg, protocols) => {
2121 return arg
2222 }
2323
24+ const doubleSlash = arg . indexOf ( '//' )
25+ if ( doubleSlash === firstColon + 1 ) {
26+ return arg
27+ }
28+
2429 const firstAt = arg . indexOf ( '@' )
2530 if ( firstAt > - 1 ) {
2631 if ( firstAt > firstColon ) {
@@ -30,11 +35,6 @@ const correctProtocol = (arg, protocols) => {
3035 }
3136 }
3237
33- const doubleSlash = arg . indexOf ( '//' )
34- if ( doubleSlash === firstColon + 1 ) {
35- return arg
36- }
37-
3838 return `${ arg . slice ( 0 , firstColon + 1 ) } //${ arg . slice ( firstColon + 1 ) } `
3939}
4040
Original file line number Diff line number Diff line change @@ -15,3 +15,10 @@ t.test('can parse file urls', async t => {
1515 t . ok ( parseUrl ( u ) )
1616 t . ok ( HostedGit . parseUrl ( u ) )
1717} )
18+
19+ t . test ( 'can parse custom urls' , async t => {
20+ const u = 'foobar://baz.com:user/repo'
21+ t . ok ( parseUrl ( u ) )
22+ t . equal ( parseUrl ( u ) . protocol , 'foobar:' )
23+ t . ok ( HostedGit . parseUrl ( u ) )
24+ } )
You can’t perform that action at this time.
0 commit comments