summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/npm-registry-client/lib/get.js
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2014-02-16 20:43:16 -0800
committerisaacs <i@izs.me>2014-02-16 20:43:16 -0800
commitec2fc4ca4d3eacaa3dc1db1673169b89233b9823 (patch)
tree0aa8a647e5111653bdf9c122182be93bf8823c7b /deps/npm/node_modules/npm-registry-client/lib/get.js
parent86b8d84811484763b251b9a8a2b9e673964ea6b5 (diff)
downloadnode-npm-v1.4.3.tar.gz
npm: upgrade to 1.4.3npm-v1.4.3
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.js8
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) }