diff --git a/packages/nodes-base/nodes/Ftp/Ftp.node.ts b/packages/nodes-base/nodes/Ftp/Ftp.node.ts index a50b15f538df9..d71f9b4d195cd 100644 --- a/packages/nodes-base/nodes/Ftp/Ftp.node.ts +++ b/packages/nodes-base/nodes/Ftp/Ftp.node.ts @@ -601,11 +601,11 @@ export class Ftp implements INodeType { await sftp!.get(path, createWriteStream(binaryFile.path)); const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i); - const filePathDownload = this.getNodeParameter('path', i) as string; + const remoteFilePath = this.getNodeParameter('path', i) as string; items[i].binary![dataPropertyNameDownload] = await this.nodeHelpers.copyBinaryFile( binaryFile.path, - filePathDownload, + basename(remoteFilePath), ); const executionData = this.helpers.constructExecutionMetaData( @@ -697,11 +697,11 @@ export class Ftp implements INodeType { await streamPipeline(stream, createWriteStream(binaryFile.path)); const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i); - const filePathDownload = this.getNodeParameter('path', i) as string; + const remoteFilePath = this.getNodeParameter('path', i) as string; items[i].binary![dataPropertyNameDownload] = await this.nodeHelpers.copyBinaryFile( binaryFile.path, - filePathDownload, + basename(remoteFilePath), ); const executionData = this.helpers.constructExecutionMetaData(