SFTP: make dir creation more robust (#1166)

This commit is contained in:
Frane Bandov
2020-11-16 18:18:48 +01:00
committed by GitHub
parent 032e2dfae5
commit c57250c71f

View File

@@ -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);
}