diff options
author | isaacs <i@izs.me> | 2014-05-06 04:03:11 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2014-05-06 04:03:11 +0400 |
commit | e698837d588efb82e6f499ce18838ec4e6905e5a (patch) | |
tree | a14c88bdc7d16bb90a7188367696e860e6948d4e /lib | |
parent | aca48cfbe5c3e838ba295a400cf2fa087f4d44bd (diff) |
Don't set referer if already set
Diffstat (limited to 'lib')
-rw-r--r-- | lib/npm.js | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/npm.js b/lib/npm.js index 63f9be315..613bf0095 100644 --- a/lib/npm.js +++ b/lib/npm.js @@ -204,17 +204,19 @@ Object.keys(abbrevs).concat(plumbing).forEach(function addCommand (c) { } if (args.length === 1) args.unshift([]) - npm.registry.refer = [a].concat(args[0]).map(function (arg) { - // exclude anything that might be a URL, path, or private module - // Those things will always have a slash in them somewhere - if (arg && arg.match && arg.match(/\/|\\/)) { - return "[REDACTED]" - } else { - return arg - } - }).filter(function (arg) { - return arg && arg.match - }).join(" ") + if (!npm.registry.refer) { + npm.registry.refer = [a].concat(args[0]).map(function (arg) { + // exclude anything that might be a URL, path, or private module + // Those things will always have a slash in them somewhere + if (arg && arg.match && arg.match(/\/|\\/)) { + return "[REDACTED]" + } else { + return arg + } + }).filter(function (arg) { + return arg && arg.match + }).join(" ") + } cmd.apply(npm, args) } |