mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 20:54:07 -08:00
⚡ SFTP: make dir creation more robust (#1166)
This commit is contained in:
parent
032e2dfae5
commit
c57250c71f
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue