FTP: transfer type set to binary

This commit is contained in:
veeso
2021-04-04 16:32:39 +02:00
parent 871a02c8b5
commit 47cd112e69
2 changed files with 10 additions and 2 deletions

View File

@@ -20,6 +20,7 @@
Released on FIXME:
- Bugfix:
- [Issue 18](https://github.com/veeso/termscp/issues/18): Set file transfer type to `Binary` for FTP
- [Issue 10](https://github.com/veeso/termscp/issues/10): Fixed port not being loaded from bookmarks into gui
- [Issue 9](https://github.com/veeso/termscp/issues/9): Fixed issues related to paths on remote when using Windows
- Dependencies:

View File

@@ -38,7 +38,7 @@ use crate::utils::parser::{parse_datetime, parse_lstime};
// Includes
use ftp4::native_tls::TlsConnector;
use ftp4::FtpStream;
use ftp4::{types::FileType, FtpStream};
use regex::Regex;
use std::path::{Path, PathBuf};
use std::time::SystemTime;
@@ -370,7 +370,14 @@ impl FileTransfer for FtpFileTransfer {
if let Err(err) = stream.login(username.as_str(), password.as_str()) {
return Err(FileTransferError::new_ex(
FileTransferErrorType::AuthenticationFailed,
format!("{}", err),
err.to_string(),
));
}
// Initialize file type
if let Err(err) = stream.transfer_type(FileType::Binary) {
return Err(FileTransferError::new_ex(
FileTransferErrorType::ProtocolError,
err.to_string(),
));
}
// Set stream