File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,6 @@ GitHost.prototype.getDefaultRepresentation = function () {
151151}
152152
153153GitHost . prototype . toString = function ( opts ) {
154- const method = this . default || /* istanbul ignore next */ 'sshurl'
155- return this [ method ] ( opts )
154+ if ( this . default && typeof this [ this . default ] === 'function' ) return this [ this . default ] ( opts )
155+ return this . sshurl ( opts )
156156}
Original file line number Diff line number Diff line change @@ -35,5 +35,7 @@ test('basic', function (t) {
3535 t . is ( HostedGit . fromUrl ( 'git+file:///foo/bar' ) , undefined , 'url that has no host' )
3636 t . is ( HostedGit . fromUrl ( 'github.com/abc/def/' ) , undefined , 'forgot the protocol' )
3737 t . is ( HostedGit . fromUrl ( 'completely-invalid' ) , undefined , 'not a url is not hosted' )
38+
39+ t . is ( HostedGit . fromUrl ( 'http://github.com/foo/bar' ) . toString ( ) , 'git+ssh://git@github.com/foo/bar.git' , 'github http protocol use git+ssh urls' )
3840 t . end ( )
3941} )
You can’t perform that action at this time.
0 commit comments