feat(139): support multipart upload (close: #7444) #7630
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
近期升级到新版个人云,被这个无法上传大文件的问题困扰。
#7444 (comment)
代码首先来自 https://github.com/ykxVK8yL5L/alist/tree/main/drivers/139 ,参考了部分代码,在此向 @ykxVK8yL5L 致谢!
如果文件分片数量大于 100 个,在网页端上传会使用第二个接口
/hcy/file/getUploadUrl
获取上传地址,这里也加上了相关逻辑,支持分片数量超过 100。加上选项可供用户自定义分片大小,暂未修改原来的分片大小。
目前网页端的分片大小为 20 MB (20971520),实测该值过小可能会拖慢大文件的上传速度,故此处提供选项供用户自行研究。
新版个人云所使用的 EOS 文档(https://ecloud.10086.cn/op-help-center/api/article/40933)中说明“无法上传大小大于 5 GB 的对象”,之前不能上传 5 GB 以上文件的原因在此,故分片大小不要超过 5 GB。