diff options
author | isaacs <i@izs.me> | 2010-12-07 22:28:28 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2010-12-07 22:28:28 +0300 |
commit | 395baa233961dc454561c1a880ac292125e7ccc6 (patch) | |
tree | 06d4cc28051bc5ff0e241ebcd0a39a9ddf12c891 | |
parent | 71685ce7883ff9b79738ee79ab3b5b9f8c5a5f60 (diff) |
Fix #427 Properly filter out garbage in tgz files.
</3 x-platform unix program dependence.
-rw-r--r-- | lib/cache.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/cache.js b/lib/cache.js index 4b1ea6c23..e056e7e79 100644 --- a/lib/cache.js +++ b/lib/cache.js @@ -314,10 +314,15 @@ function addTmpTarball (tgz, cb) { if (er) return log.er(cb, "couldn't unpack "+tgz+" to "+contents)(er) fs.readdir(contents, function (er, folder) { if (er) return log.er(cb, "couldn't readdir "+contents)(er) + log.verbose(folder, "tarball contents") if (folder.length > 1) { + folder = folder.filter(function (f) { return !f.match(/^\./) }) } - if (!folder.length) return cb(new Error( - "Empty package tarball")) + if (folder.length > 1) { + log.warn(folder.slice(1).join("\n") + ,"extra junk in folder, ignoring") + } + if (!folder.length) return cb(new Error("Empty package tarball")) folder = path.join(contents, folder[0]) var newName = path.join(contents, "package") fs.rename(folder, newName, function (er) { |