-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(baidu_netdisk): support resuming uploads when an error occurs #1279
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
base: main
Are you sure you want to change the base?
Conversation
已经修改PR Tittle,workflow的release.yml也已经手动恢复为目前仓库main的版本,但是不太清楚应该怎么去除,还是我应该重新fork? |
可以手动直接还原更改前,也可用revert |
Signed-off-by: jenfonro <[email protected]>
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 fixes the BaiduNetdisk driver to support resuming uploads when an upload error occurs, extending the existing resumable upload functionality beyond just user cancellations.
- Removes the restriction that only allowed resumable uploads on user cancellation
- Adds detection and handling for expired uploadid scenarios with automatic retry
- Improves error messages and progress tracking during uploads
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
drivers/baidu_netdisk/driver.go | Main implementation adding uploadid expiration detection, retry logic, and enhanced error handling for resumable uploads |
.github/workflows/release.yml | Removes trailing whitespace from workflow file |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
已更新,并完成测试 |
params := map[string]string{"method": "precreate"} | ||
form := map[string]string{ | ||
"path": path, | ||
"size": strconv.FormatInt(streamSize, 10), | ||
"isdir": "0", | ||
"autoinit": "1", | ||
"rtype": "3", | ||
"block_list": blockListStr, | ||
} | ||
joinTime(form, ctime, mtime) | ||
var newPre PrecreateResp | ||
_, err2 := d.postForm("/xpan/file", params, form, &newPre) | ||
if err2 != nil { | ||
return nil, err2 | ||
} | ||
if newPre.ReturnType == 2 { | ||
newPre.File.Ctime = ctime | ||
newPre.File.Mtime = mtime | ||
return fileToObj(newPre.File), nil | ||
} |
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.
我觉得precreate的过程最好单独放在一个函数里,只是建议,你可以考虑一下
我不太清楚 |
Description / 描述
修改百度云盘驱动在错误时支持断点续传
Motivation and Context / 背景
目前的驱动已经支持断点续传,但是只有用户主动取消才生效,现在将该逻辑去除,在任务未过期的情况下,会进行断点续传
主要用点在于,因网络错误上传中断时,进行继续上传
How Has This Been Tested? / 测试
Checklist / 检查清单
我已阅读 CONTRIBUTING 文档。
go fmt
or prettier.我已使用
go fmt
或 prettier 格式化提交的代码。我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
我已相应更新了相关仓库(若适用)。