-
Notifications
You must be signed in to change notification settings - Fork 62
Description
Please provide the following (and please check them off the list with [x]) before submitting this issue:
- Expected behavior. Please provide links to the specific Microsoft Graph documentation you used to determine the expected behavior.
- Actual behavior. Provide error codes, stack information, and a Fiddler capture of the request and response (please remove personally identifiable information before posting).
- Steps to reproduce the behavior. Include your code, IDE versions, client library versions, and any other information that might be helpful to understand your scenario.
Expected behavior
https://microsoftgraph.github.io/msgraph-sdk-design/tasks/FileUploadTask.html
If you do a quick find on this page, you'll see that it mentions that the default slice size is 5 MB. I see this number in multiple places, whether it's code or docs.
I'd expect that if I don't give the LargeFileUploadTask ctor a value for maxSliceSize, it would use 5 MiB.
Actual behavior
The default is 4 MiB, which throws an exception, because it's not fully divisible by 320 KiB.
Steps to reproduce the behavior
var uploadSession = await _client.Drives[_driveID].Items[_driveItemID].ItemWithPath(fileName).CreateUploadSession().Request().PostAsync();
var largeFileUploadTask = new LargeFileUploadTask<DriveItem>(uploadSession, ms);msgraph-sdk-dotnet-core/src/Microsoft.Graph.Core/Tasks/LargeFileUploadTask.cs
Lines 16 to 19 in b2d9d7c
| public class LargeFileUploadTask<T> | |
| { | |
| private const int DefaultMaxSliceSize = 4 * 1024 * 1024; | |
| private const int RequiredSliceSizeIncrement = 320 * 1024; |
msgraph-sdk-dotnet-core/src/Microsoft.Graph.Core/Tasks/LargeFileUploadTask.cs
Lines 47 to 51 in b2d9d7c
| this._maxSliceSize = maxSliceSize < 0 ? DefaultMaxSliceSize : maxSliceSize; | |
| if (this._maxSliceSize % RequiredSliceSizeIncrement != 0) | |
| { | |
| throw new ArgumentException("Max slice size must be a multiple of 320 KiB", nameof(maxSliceSize)); | |
| } |
Since 5 MiB is divisible by 320 KiB, can we just change the constant in the class?
Side Question
Should we be using LargeFileUploadTask now or ChunkedUploadProvider? The link I gave above for docs suggests LargeFileUploadTask.