Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Prevent `addFiles` timing out on empty `filenames` array

If addFiles is passed an empty `filenames` array it will eventually 
timeout as the callback will never be called.  This change 
calls the callback immediately when `filenames.length` is 0.
  • Loading branch information...
commit ddd234d35f132d8ed5e3919f4b0e2469d16689e2 1 parent 5c50e68
Danny Amey authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 janzip/janzip.js
4 janzip/janzip.js
View
@@ -105,6 +105,10 @@ var Zip = function () {
}
};
+ if (!filenames.length) {
+ return callback && callback(fileErr);
+ }
+
filenames.forEach(function (f) {
fs.readFile(f.path, function (err, data) {
if (err) {
Please sign in to comment.
Something went wrong with that request. Please try again.