microsoftgraph / msgraph-sdk-serviceissues

Tracks service issues for follow up.
5 stars 0 forks source link

Upload file using upload session break some content #125

Open rlodev67 opened 2 years ago

rlodev67 commented 2 years ago

Hi everyone, Describe the bug I'm trying to upload file bigger than 4MB using the CreateUploadSession method coming from another sharepoint tenant. When i'm downloading the content of the file and upload it to the other tenant the target file size changed and the QuickXorHash value too. If i'm testing the same thing with a file smaller than 4MB, I'm able to reproduce it. (File always miss 11 bytes). But when I'm using the PutAsync method (for file smaller than 4MB) the hash and file size are correct. I tried with more than 1 file and each time I have the same result and each time it's missing 11 bytes. To Reproduce Steps to reproduce the behavior:

long readBufferSize = 320 * 1024 * 1;
var uploadSessionRequest = targetGraph.graphClientApp.Groups[targetTeam.Id].Drive.Items[targetFolder.Id].ItemWithPath(item.Name).CreateUploadSession().Request().PostAsync();
uploadSessionRequest.Wait();
var result = sourceGraph.graphClientApp.Groups[sourceTeam.Id].Drive.Items[item.Id].Content.Request().GetAsync();
result.Wait();
var a = result.Result;
var largeFileUpload = new LargeFileUploadTask<DriveItem>(uploadSessionRequest.Result, a, ((int)readBufferSize)).UploadAsync();
largeFileUpload.Wait();

Expected behavior Item hash and size should be the same Even in windows, the file size are differents (uploaded file is smaller than source file)

Additional context I tried using a simple HttpClient and the result is the same, it looks like the issue is at server side. In my case, i'm downloading a file from one tenant and upload it to another tenant.

Any idea / workarround ?

andrueastman commented 2 years ago

Hey @rlodev67,

Thanks for raising this.

When you download the file, is it already smaller than expected? Or do you download the file again after uploading and compare it with the hash of the original download?

rlodev67 commented 2 years ago

Hey,

when I download the file from the originial tenant, the file size is correct. after the upload, when I download the file, the file is smaler and if I compare the hash between the source file and the target file, the hash is different.

andrueastman commented 2 years ago

Thanks for the extra information @rlodev67,

As this seems to be API related from your query, are you able to also post the same query on the Microsoft Graph Q/A (link below) site so that we may get input from the relevant API owners? It would be great if you could post back the link to the question in this issue as well so that it may help others find the information we get from them.

https://docs.microsoft.com/en-us/answers/topics/microsoft-graph-files.html

rlodev67 commented 2 years ago

Thanks @andrueastman ,

I will update this issue as soon as I have an answer :) If someone would like to follow it : https://docs.microsoft.com/en-us/answers/questions/707056/upload-file-using-upload-session-break-some-conten.html

petrhollayms commented 2 months ago

Thank you for reporting this issue. This appears to be an issue or limitation with the service APIs. Unfortunately, as the Microsoft Graph SDK team, we do not have ownership of the APIs that are causing you issues. We invite you to create a question about the service API to Microsoft Q&A and tagged with one of the [microsoft-graph-*] tags, that way it will get routed to the appropriate team for them to triage.

https://aka.ms/askgraph

For now, we will close the issue on our side but feel free to open it in the relevant repository if you think the issue is specific to SDK. Please let us know if this helps!

Note: We will close this repository on April 19, 2024.