diff options
Diffstat (limited to 'deps/npm/node_modules/npm-registry-client/lib/get.js')
-rw-r--r-- | deps/npm/node_modules/npm-registry-client/lib/get.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/deps/npm/node_modules/npm-registry-client/lib/get.js b/deps/npm/node_modules/npm-registry-client/lib/get.js index eeb716e85..bb6d525b8 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/get.js +++ b/deps/npm/node_modules/npm-registry-client/lib/get.js @@ -31,9 +31,15 @@ function get (uri, timeout, nofollow, staleOk, cb) { var cacheUri = uri // on windows ":" is not an allowed character in a foldername - cacheUri = cacheUri.replace(/:/g, '_') + cacheUri = cacheUri.replace(/:/g, '_').replace(/\?write=true$/, '') var cache = path.join(this.conf.get('cache'), cacheUri, ".cache.json") + // If the GET is part of a write operation (PUT or DELETE), then + // skip past the cache entirely, but still save the results. + if (uri.match(/\?write=true$/)) + return get_.call(this, uri, timeout, cache, null, null, nofollow, staleOk, cb) + + fs.stat(cache, function (er, stat) { if (!er) fs.readFile(cache, function (er, data) { try { data = JSON.parse(data) } |