From e12a106d6890fc32b23ca4c35fa547625923c05c Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Sat, 28 Sep 2024 13:38:00 +0800 Subject: [PATCH] Try fix sftp read Signed-off-by: Xuanwo --- core/src/services/sftp/backend.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/services/sftp/backend.rs b/core/src/services/sftp/backend.rs index 8e3c103f786..d6ec3c08041 100644 --- a/core/src/services/sftp/backend.rs +++ b/core/src/services/sftp/backend.rs @@ -396,6 +396,8 @@ impl Access for SftpBackend { .await .map_err(parse_sftp_error)?; + let meta = f.metadata().await.map_err(parse_sftp_error)?; + if args.range().offset() != 0 { f.seek(SeekFrom::Start(args.range().offset())) .await @@ -404,7 +406,7 @@ impl Access for SftpBackend { Ok(( RpRead::default(), - SftpReader::new(client, f, args.range().size()), + SftpReader::new(client, f, args.range().size().and(meta.len())), )) }