From a27d7b1fdc8be778f7f055294becb3bbf86ce21f Mon Sep 17 00:00:00 2001 From: zzhengzhuo015 Date: Sun, 8 Mar 2026 13:55:35 +0800 Subject: [PATCH] fix: fix sftp timeout error --- clawpal-core/src/ssh/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/clawpal-core/src/ssh/mod.rs b/clawpal-core/src/ssh/mod.rs index b2adbd1..6c05d3b 100644 --- a/clawpal-core/src/ssh/mod.rs +++ b/clawpal-core/src/ssh/mod.rs @@ -190,6 +190,11 @@ impl SshSession { .channel_open_session() .await .map_err(|e| SshError::Sftp(e.to_string()))?; + channel + .request_subsystem(true, "sftp") + .await + .map_err(|e| SshError::Sftp(e.to_string()))?; + let sftp = russh_sftp::client::SftpSession::new(channel.into_stream()) .await .map_err(|e| SshError::Sftp(e.to_string()))?; @@ -221,10 +226,16 @@ impl SshSession { Backend::Russh { handle } => handle.clone(), Backend::Legacy => return self.sftp_write_legacy(path, content).await, }; + let channel = handle .channel_open_session() .await .map_err(|e| SshError::Sftp(e.to_string()))?; + channel + .request_subsystem(true, "sftp") + .await + .map_err(|e| SshError::Sftp(e.to_string()))?; + let sftp = russh_sftp::client::SftpSession::new(channel.into_stream()) .await .map_err(|e| SshError::Sftp(e.to_string()))?;