Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Merged
merged 1 commit into from

2 participants

@dannyamey

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.

Danny Amey 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.
ddd234d
@janjongboom
Owner

Thanks for the fix. I'll pull it in. Please note that four spaces are used for indentation, instead of two. I'll correct it myself this time.

@janjongboom janjongboom merged commit 204b180 into janjongboom:master
@dannyamey dannyamey deleted the unknown repository branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 13, 2012
  1. Prevent `addFiles` timing out on empty `filenames` array

    Danny Amey authored
    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.
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 0 deletions.
  1. +4 −0 janzip/janzip.js
View
4 janzip/janzip.js
@@ -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) {
Something went wrong with that request. Please try again.