Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix updating Git URLs with credentials in them

Allow urls with "@", for example git+https://user:pass@domain.com/repository.git

The code previously returned "domain.com/repository.git" instead of
"git+https://user:pass@domain.com/repository.git".
  • Loading branch information...
commit 93fc36461ca03d312d1dfe61faf08b31fc77dc94 1 parent 3a6942d
@danielsantiago danielsantiago authored domenic committed
View
2  lib/install.js
@@ -707,7 +707,7 @@ function targetResolver (where, context, deps) {
// if the target is a git repository, we always want to fetch it
var isGit = false
- , maybeGit = what.split("@").pop()
+ , maybeGit = what.split("@").slice(1).join()
if (maybeGit)
isGit = isGitUrl(url.parse(maybeGit))
View
3  test/tap/outdated-git.js
@@ -12,12 +12,13 @@ mkdirp.sync(pkg + "/cache")
test("dicovers new versions in outdated", function (t) {
process.chdir(pkg)
- t.plan(3)
+ t.plan(4)
npm.load({cache: pkg + "/cache", registry: common.registry}, function () {
npm.outdated(function (er, d) {
t.equal('git', d[0][3])
t.equal('git', d[0][4])
t.equal('git://github.com/robertkowalski/foo-private.git', d[0][5])
+ t.equal('git://user:pass@github.com/robertkowalski/foo-private.git', d[1][5])
})
})
})
View
3  test/tap/outdated-git/package.json
@@ -5,6 +5,7 @@
"version": "0.0.1",
"main": "index.js",
"dependencies": {
- "foo-private": "git://github.com/robertkowalski/foo-private.git"
+ "foo-private": "git://github.com/robertkowalski/foo-private.git",
+ "foo-private-credentials": "git://user:pass@github.com/robertkowalski/foo-private.git"
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.