diff --git a/lib/connection.js b/lib/connection.js index 6e249a5..ad6692c 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -410,6 +410,10 @@ FTP.prototype.logout = function(cb) { FTP.prototype.listSafe = function(path, zcomp, cb) { if (typeof path === 'string') { + if (typeof zcomp === 'function') { + cb = zcomp; + zcomp = false; + } var self = this; // store current path this.pwd(function(err, origpath) { @@ -785,7 +789,7 @@ FTP.prototype.rmdir = function(path, recursive, cb) { // RMD is optional } var self = this; - this.list(path, function(err, list) { + this.listSafe(path, function(err, list) { if (err) return cb(err); var idx = 0;