From 8bf7e89de081a091560d15693ab8b5b39316619f Mon Sep 17 00:00:00 2001 From: "pascal.gattino@gmail.com" Date: Mon, 2 Dec 2024 17:01:18 +0100 Subject: [PATCH] Fix: Set FTP file type to binary if binaryMode is enabled Added a check to ensure that the FTP file type is set to binary when the binaryMode flag is enabled. This ensures that files are transferred in binary mode, which is necessary for handling non-text files correctly. --- .../java/org/apache/hop/workflow/actions/ftp/ActionFtp.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/ftp/ActionFtp.java b/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/ftp/ActionFtp.java index 06acf28f6d1..df016e8c6cb 100644 --- a/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/ftp/ActionFtp.java +++ b/plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/ftp/ActionFtp.java @@ -27,6 +27,7 @@ import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.vfs2.FileObject; @@ -436,6 +437,10 @@ public Result execute(Result previousResult, int nr) { limitFiles = Const.toInt(resolve(getNrLimit()), 10); } + if (binaryMode) { + ftpClient.setFileType(FTP.BINARY_FILE_TYPE); + } + // Get the files in the list... for (FTPFile ftpFile : ftpFiles) {