修复: 连接回退池校验与进度重试累计等四处
- connect 失败回退目标校验仍在池中,防幻影本地列表 - SFTP 下载/上传进度跨重试累计,重试入口重置基线 - OSS 签名 base64 改标准字母表,URL 字母表致校验必败 - 剪切粘贴同目录 no-op 清剪贴板,防源文件被改名副本
This commit is contained in:
@@ -632,7 +632,10 @@ func (s *Service) downloadFileTo(c *Client, remotePath, localPath string, copied
|
||||
if err := os.MkdirAll(filepath.Dir(localPath), 0755); err != nil {
|
||||
return fmt.Errorf("创建本地目录失败: %w", err)
|
||||
}
|
||||
// 重试会整文件重写,进度须回到进入前基线,否则跨重试累计使 copied 超过 total
|
||||
base := *copied
|
||||
return c.WithRetry(func(sc *sftpclient.Client) error {
|
||||
*copied = base
|
||||
src, err := sc.Open(remotePath)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -722,7 +725,10 @@ func (s *Service) UploadFromFile(connID, localPath, remoteDir string, onProgress
|
||||
|
||||
// uploadFileTo 流式上传单个本地文件(自动创建远端父目录),进度按累计字节回调
|
||||
func (s *Service) uploadFileTo(c *Client, localPath, remotePath string, copied *int64, total int64, onProgress func(fileName string, copied, total int64)) error {
|
||||
// 重试会整文件重传,进度须回到进入前基线,否则跨重试累计使 copied 超过 total
|
||||
base := *copied
|
||||
return c.WithRetry(func(sc *sftpclient.Client) error {
|
||||
*copied = base
|
||||
if err := sc.MkdirAll(path.Dir(remotePath)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user