Updating NPM dependencies
This commit is contained in:
27
node_modules/hosted-git-info/index.js
generated
vendored
27
node_modules/hosted-git-info/index.js
generated
vendored
@@ -47,7 +47,7 @@ function fromUrl (giturl, opts) {
|
||||
var gitHostInfo = gitHosts[gitHostName]
|
||||
var auth = null
|
||||
if (parsed.auth && authProtocols[parsed.protocol]) {
|
||||
auth = decodeURIComponent(parsed.auth)
|
||||
auth = parsed.auth
|
||||
}
|
||||
var committish = parsed.hash ? decodeURIComponent(parsed.hash.substr(1)) : null
|
||||
var user = null
|
||||
@@ -106,7 +106,30 @@ function fixupUnqualifiedGist (giturl) {
|
||||
|
||||
function parseGitUrl (giturl) {
|
||||
var matched = giturl.match(/^([^@]+)@([^:/]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/)
|
||||
if (!matched) return url.parse(giturl)
|
||||
if (!matched) {
|
||||
var legacy = url.parse(giturl)
|
||||
// If we don't have url.URL, then sorry, this is just not fixable.
|
||||
// This affects Node <= 6.12.
|
||||
if (legacy.auth && typeof url.URL === 'function') {
|
||||
// git urls can be in the form of scp-style/ssh-connect strings, like
|
||||
// git+ssh://user@host.com:some/path, which the legacy url parser
|
||||
// supports, but WhatWG url.URL class does not. However, the legacy
|
||||
// parser de-urlencodes the username and password, so something like
|
||||
// https://user%3An%40me:p%40ss%3Aword@x.com/ becomes
|
||||
// https://user:n@me:p@ss:word@x.com/ which is all kinds of wrong.
|
||||
// Pull off just the auth and host, so we dont' get the confusing
|
||||
// scp-style URL, then pass that to the WhatWG parser to get the
|
||||
// auth properly escaped.
|
||||
var authmatch = giturl.match(/[^@]+@[^:/]+/)
|
||||
/* istanbul ignore else - this should be impossible */
|
||||
if (authmatch) {
|
||||
var whatwg = new url.URL(authmatch[0])
|
||||
legacy.auth = whatwg.username || ''
|
||||
if (whatwg.password) legacy.auth += ':' + whatwg.password
|
||||
}
|
||||
}
|
||||
return legacy
|
||||
}
|
||||
return {
|
||||
protocol: 'git+ssh:',
|
||||
slashes: true,
|
||||
|
||||
Reference in New Issue
Block a user