microsoftgraph / microsoftgraph/msgraph-sdk-java
LargeFileUploadTask.resume() may update rangesRemaining but does not handle modifying the InputStream accordingly
还没有人认领这个 Issue。
- 主要语言
- Java
- 星标
- 444
- 派生
- 154
- 平均合并
- 18 小时 28 分钟
- 30 天内合并 PR
- 4
描述
Is your feature request related to a problem? Please describe the problem.
I may be misunderstanding something about the SDK but her is my problem.
Im using Android and com.microsoft.graph:microsoft-graph:6.54.0. If I recreate an upload session where the LargeFileUploadTask had uploaded som of the file, and use it to recreate a LargeFileUploadTask and call resume() internally the SDK calls updateSessionStatus() and may update rangesRemaining. However it does not modify my provided InputStream based on this. So when it calls upload() and slices are later created for upload it uses the wrong data and the resulting file is corrupted.
I can not prepare the InputStream because I do not know what rangesRemaining is going to be (hence resume is asking the API) so the only way around it I can see is using updateSessionStatus() myself, adjust the InputStream and call upload() instead.
This works but is what I would assume the resume() function to handle.
Describe the solution you'd like.
It would be good if the resume function could handle the InputStream itself.
If that is not possible maybe provide some way, like a callback in resume(), where I get the new session with potentially new rangesRemaining and can modify my InputStream before the internal upload() call.
Or provide more information in the javadoc so future users do not run into the same wrong assumptions about InputStream handling I did.
Or remove/hide resume() removing the temptation to use it. It seams dangerous for it to ask the API for a new correct range with no way for the developer to act on it before uploading starts.
Additional context?
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先定位 LargeFileUploadTask.resume()、updateSessionStatus() 和 upload(),然后跟踪重新创建的上传会话恢复后 rangesRemaining 和提供的 InputStream 是如何使用的。在 Android 上或等效测试中重现部分上传会话的场景;完成标准是恢复的上传使用正确的流位置,或在上传前明确公开更新后的范围。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- api
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100