Skip to content

Commit

Permalink
Fix: Set FTP file type to binary if binaryMode is enabled
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Pask42 committed Dec 2, 2024
1 parent 64b5529 commit 8bf7e89
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {

Expand Down

0 comments on commit 8bf7e89

Please sign in to comment.