From 8d0a78c2290437b963eab8fa2bf6a2a0a68f2fd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20Andr=C3=A1s=20Horv=C3=A1th?= Date: Fri, 7 Jul 2017 17:47:05 +0200 Subject: [PATCH] Fix #890 --- lib/connectors/ftp.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/connectors/ftp.js b/lib/connectors/ftp.js index 34c4e2e..45ee5f2 100644 --- a/lib/connectors/ftp.js +++ b/lib/connectors/ftp.js @@ -434,17 +434,19 @@ export default (function INIT() { if (self.isConnected()) { self.ftp.list(path, false, (listErr, list) => { - const files = list.filter(o => o.type === 'f'); - - // File exists - if (typeof list !== 'undefined' && files.length !== 0) { - if (enableTransfer) { - atom.notifications.addWarning('The file already exists.', { - detail: `${path} has already on the server!`, - }); + if (typeof list !== 'undefined') { + const files = list.filter(o => o.type === '-'); + + // File exists + if (files.length !== 0) { + if (enableTransfer) { + atom.notifications.addWarning('The file already exists.', { + detail: `${path} has already on the server!`, + }); + } + tryApply(completed, null, [listErr]); + return; } - tryApply(completed, null, [listErr]); - return; } self.ftp.put(empty, path, (putErr) => {