From c57250c71f1224e04e92d6cfefa5518e953f721e Mon Sep 17 00:00:00 2001 From: Frane Bandov Date: Mon, 16 Nov 2020 18:18:48 +0100 Subject: [PATCH] :zap: SFTP: make dir creation more robust (#1166) --- packages/nodes-base/nodes/Ftp.node.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/nodes-base/nodes/Ftp.node.ts b/packages/nodes-base/nodes/Ftp.node.ts index dacbd40a5d..71a864bd02 100644 --- a/packages/nodes-base/nodes/Ftp.node.ts +++ b/packages/nodes-base/nodes/Ftp.node.ts @@ -348,13 +348,11 @@ export class Ftp implements INodeType { const remotePath = this.getNodeParameter('path', i) as string; // Check if dir path exists - const dirExists = await sftp!.exists(dirname(remotePath)); + const dirPath = dirname(remotePath); + const dirExists = await sftp!.exists(dirPath); // If dir does not exist, create all recursively in path if (!dirExists) { - // Separate filename from dir path - const fileName = basename(remotePath); - const dirPath = remotePath.replace(fileName, ''); // Create directory await sftp!.mkdir(dirPath, true); }