-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
fix(139): refactor part upload logic #1184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
|
不对不对,官网上传也是一次性获取所有地址。反倒是越改越错。如果是分批调用 /file/getUploadUrl 的话,请求 101~200 分片,返回从 190 开始。 成功复现 400 报错,内容如下: |
仔细看了下,是数组排序不对,匹配到错误的分片上传,肯定不正常。 |
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the multipart upload logic for the 139 cloud driver to improve reliability and error handling. The key changes focus on batch processing upload URLs and proper sorting to prevent upload failures.
- Extracts upload logic into a separate reusable function for better maintainability
- Implements batch processing to avoid upload URL expiration issues
- Adds proper sorting of part upload information and enhanced error handling
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| drivers/139/util.go | Adds new uploadPersonalParts function with proper sorting and error handling for multipart uploads |
| drivers/139/driver.go | Refactors main upload logic to use batch processing and the new upload function |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…ds errors Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
KirCute
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* fix(139): refactor part upload logic Signed-off-by: MadDogOwner <xiaoran@xrgzs.top> * fix(139): handle upload errors Signed-off-by: MadDogOwner <xiaoran@xrgzs.top> * fix(139): sort upload parts by PartNumber before uploading Signed-off-by: MadDogOwner <xiaoran@xrgzs.top> * fix(139): improve error handling Signed-off-by: MadDogOwner <xiaoran@xrgzs.top> * fix(139): add validation for upload part index to prevent out of bounds errors Signed-off-by: MadDogOwner <xiaoran@xrgzs.top> --------- Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
Description / 描述
重构新个人云的分片上传逻辑,逐批获取上传链接并上传,避免分片上传地址过期导致上传失败。
对分片上传信息进行排序,避免因排序错误导致上传失败。
优化错误处理,返回分片上传错误信息。
Motivation and Context / 背景
Closes https://github.com/orgs/OpenListTeam/discussions/1167
How Has This Been Tested? / 测试
返回的分片排序不正确:
能够使用正确的顺序上传分片:
Checklist / 检查清单
我已阅读 CONTRIBUTING 文档。
go fmtor prettier.我已使用
go fmt或 prettier 格式化提交的代码。我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
我已相应更新了相关仓库(若适用)。