microsoftgraph / microsoftgraph/msgraph-sdk-java
LargeFileUploadTask.resume() may update rangesRemaining but does not handle modifying the InputStream accordingly
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 444
- Forks
- 154
- Avg merge
- 18h 28m
- Merged PRs (30d)
- 4
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating LargeFileUploadTask.resume(), updateSessionStatus(), and upload(), then trace how rangesRemaining and the provided InputStream are used after a recreated upload session is resumed. Reproduce the partially uploaded session scenario on Android or in an equivalent test; done means resumed uploads use the correct stream position or clearly expose the updated ranges before uploading.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100