diff --git a/src/server/controlchan/commands/pwd.rs b/src/server/controlchan/commands/pwd.rs index 8299f03a..1d57ed4c 100644 --- a/src/server/controlchan/commands/pwd.rs +++ b/src/server/controlchan/commands/pwd.rs @@ -28,9 +28,15 @@ where async fn handle(&self, args: CommandContext) -> Result { let session = args.session.lock().await; // TODO: properly escape double quotes in `cwd` - Ok(Reply::new_with_string( - ReplyCode::DirCreated, - format!("\"{}\"", session.cwd.as_path().display()), - )) + + let result = format!("\"{}\"", session.cwd.as_path().display()); + + // On Windows systems, the path will be formatted with Windows style separators ('\') + // Most FTP clients expect normal UNIX separators ('/'), and they have trouble handling + // Windows style separators, so if we are on a Windows host, we replace the separators here. + #[cfg(windows)] + let result = result.replace(std::path::MAIN_SEPARATOR, "/"); + + Ok(Reply::new_with_string(ReplyCode::DirCreated, result)) } } diff --git a/src/server/proxy_protocol.rs b/src/server/proxy_protocol.rs index 64a2eacd..b17fd53d 100644 --- a/src/server/proxy_protocol.rs +++ b/src/server/proxy_protocol.rs @@ -219,7 +219,7 @@ where mod tests { use super::ProxyError; use proxy_protocol::{version1::ProxyAddresses, ProxyHeader}; - use std::net::SocketAddrV4; + use std::net::{SocketAddrV4, Ipv4Addr}; use std::time::Duration; use tokio::io::AsyncWriteExt; use tokio::time::sleep;