microsoftgraph / microsoftgraph/msgraph-sdk-java

LargeFileUploadTask.resume() may update rangesRemaining but does not handle modifying the InputStream accordingly

Ouverte
#2,503 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

status:waiting-for-triage type:feature
Langage dominant
Java
Étoiles
444
Forks
154
Merge moyen
18 h 28 min
PR mergées (30 j)
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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par localiser LargeFileUploadTask.resume(), updateSessionStatus() et upload(), puis retracez l’utilisation de rangesRemaining et de l’InputStream fourni après la reprise d’une session de téléversement recréée. Reproduisez le scénario d’une session partiellement téléversée sur Android ou dans un test équivalent ; le travail est terminé lorsque les téléversements repris utilisent la position correcte du flux ou exposent clairement les plages mises à jour avant le téléversement.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
api
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.