Skip to content

Commit

Permalink
⚡ SFTP: make dir creation more robust (n8n-io#1166)
Browse files Browse the repository at this point in the history
  • Loading branch information
frane authored Nov 16, 2020
1 parent 032e2df commit c57250c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/nodes-base/nodes/Ftp.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit c57250c

Please sign in to comment.