Skip to content

fix(drivers/guangyapan): report multipart upload progress to copy task - #2989

Open
hugcabbage wants to merge 1 commit into
OpenListTeam:mainfrom
hugcabbage:main
Open

fix(drivers/guangyapan): report multipart upload progress to copy task#2989
hugcabbage wants to merge 1 commit into
OpenListTeam:mainfrom
hugcabbage:main

Conversation

@hugcabbage

Copy link
Copy Markdown

Summary / 摘要

修复 GuangYaPan 驱动 OSS 分片上传不更新任务进度的问题。

背景:从其他存储(跨存储复制)复制到光鸭云盘时,OpenList 会创建
FileTransferTask 并通过 GuangYaPan.Put -> multipartUploadToOSS 上传,
但该函数把进度回调 up 传入 stream.NewStreamSectionReader 后从未再调用,
NewStreamSectionReader 的实现会忽略 up 参数,导致任务进度始终为 0,
任务列表不显示进度条和速度。

修复:在 multipartUploadToOSS 的分片循环中累计已上传字节数,并在每个
分片上传完成后调用 up(100 * uploaded / total) 上报进度,与其他驱动保持
一致的实现方式。

Behavior changes / 用户可感知的行为变化

  • 跨存储复制到光鸭云盘时,管理后台「任务」列表中的复制任务现在会实时显示
    进度条与速度(此前停留在 0%)。
  • 同存储复制行为不变(仍走驱动内 copy_file 异步任务,不经任务系统)。

Implementation changes / 重要实现变化

  • drivers/guangyapan/util.gomultipartUploadToOSS 新增 uploaded 累计
    计数,每分片上传成功后调用 up 上报百分比进度。
  • This PR has breaking changes.
    / 此 PR 包含破坏性变更。
  • This PR changes public API, config, storage format, or migration behavior.
    / 此 PR 修改了公开 API、配置、存储格式或迁移行为。
  • This PR requires corresponding changes in related repositories.
    / 此 PR 需要关联仓库同步修改。

Related repository PRs / 关联仓库 PR:

  • OpenList-Frontend:
  • OpenList-Docs:

Related Issues / 关联 Issue

Relates to #2970

Testing / 测试

  • go build ./drivers/guangyapan/
  • go test ./...
  • Manual test / 手动测试: 在真实账号上执行跨存储复制到光鸭云盘, 确认任务列表进度条随分片上传增长。

Checklist / 检查清单

  • I have read CONTRIBUTING.
    / 我已阅读 CONTRIBUTING
  • I confirm this contribution follows the repository license, contribution policy, and code of conduct.
    / 我确认此贡献符合仓库许可证、贡献规范和行为准则。
  • I have formatted the changed code with gofmt, go fmt, or prettier where applicable.
    / 我已按适用情况使用 gofmtgo fmtprettier 格式化变更代码。
  • I have requested review from relevant maintainers or code owners where applicable.
    / 我已在适用情况下请求相关维护者或代码所有者审查。

AI Disclosure / AI 使用声明

  • This PR includes AI-assisted content.
    / 此 PR 包含 AI 辅助内容。

Tools used / 使用工具:

  • ChatGPT
  • Codex
  • GitHub Copilot
  • Claude
  • Gemini
  • Other (please specify) / 其他(请注明): WorkBuddy 自主智能体

Usage scope / 使用范围:

  • Code generation / 代码生成
  • Refactoring / 重构
  • Documentation / 文档
  • Tests / 测试
  • Translation / 翻译
  • Review assistance / 审查辅助
  • I have reviewed and validated all AI-assisted content included in this PR.
    / 我已审核并验证此 PR 中的所有 AI 辅助内容。
  • I have ensured that all AI-assisted commits include Co-Authored-By attribution.
    / 我已确保所有 AI 辅助提交都包含 Co-Authored-By 归属信息。
  • I can reproduce all AI-assisted content included in this PR without any AI tools.
    / 我可以在没有任何 AI 工具的情况下重现此 PR 中包含的所有 AI 辅助内容。

multipartUploadToOSS passed the UpdateProgress callback into
stream.NewStreamSectionReader, which ignores the up argument, so the
callback was never invoked while uploading parts. As a result,
cross-storage copy tasks targeting GuangYaPan stayed at 0% and showed no
progress bar or speed in the task list.

Fix by tracking the uploaded byte count and invoking up after every
part is uploaded, keeping consistent with other drivers' upload flow.
@xrgzs
xrgzs requested a review from pikachuren August 29, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant