From 44a077e588ddff1ee9422f6e3cc79b6cec970156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20=C4=8Cernock=C3=BD?= Date: Sat, 19 Dec 2020 17:16:50 +0100 Subject: [PATCH] Fixed rmdir operation with recursion on nonexist directory --- lib/connection.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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;