diff options
Diffstat (limited to 'lib/bugs.js')
-rw-r--r-- | lib/bugs.js | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/bugs.js b/lib/bugs.js index b3022bf2a..41f1386b0 100644 --- a/lib/bugs.js +++ b/lib/bugs.js @@ -10,13 +10,16 @@ var npm = require("./npm.js") , path = require("path") , readJson = require("read-package-json") , fs = require("fs") - , url = require("url") + , mapToRegistry = require("./utils/map-to-registry.js") bugs.completion = function (opts, cb) { if (opts.conf.argv.remain.length > 2) return cb() - var uri = url.resolve(npm.config.get("registry"), "-/short") - registry.get(uri, { timeout : 60000 }, function (er, list) { - return cb(null, list || []) + mapToRegistry("-/short", npm.config, function (er, uri) { + if (er) return cb(er) + + registry.get(uri, { timeout : 60000 }, function (er, list) { + return cb(null, list || []) + }) }) } @@ -56,9 +59,13 @@ function getUrlAndOpen (d, cb) { } function callRegistry (n, cb) { - var uri = url.resolve(npm.config.get("registry"), n + "/latest") - registry.get(uri, { timeout : 3600 }, function (er, d) { + mapToRegistry(n, npm.config, function (er, uri) { if (er) return cb(er) - getUrlAndOpen (d, cb) + + registry.get(uri + "/latest", { timeout : 3600 }, function (er, d) { + if (er) return cb(er) + + getUrlAndOpen (d, cb) + }) }) } |