File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2468,9 +2468,6 @@ protected virtual async Task<OneDriveItem> UploadFileViaResumableUploadInternal(
24682468 throw new ArgumentNullException ( "oneDriveUploadSession" ) ;
24692469 }
24702470
2471- // Get an access token to perform the request to OneDrive
2472- var accessToken = await GetAccessToken ( ) ;
2473-
24742471 // Amount of bytes succesfully sent
24752472 long totalBytesSent = 0 ;
24762473
@@ -2489,8 +2486,10 @@ protected virtual async Task<OneDriveItem> UploadFileViaResumableUploadInternal(
24892486 // Defines a buffer which will be filled with bytes from the original file and then sent off to the OneDrive webservice
24902487 var fragmentBuffer = new byte [ fragmentSizeInBytes ?? ResumableUploadChunkSizeInBytes ] ;
24912488
2492- // Create an HTTPClient instance to communicate with the REST API of OneDrive to perform the upload
2493- using ( var client = CreateHttpClient ( accessToken . AccessToken ) )
2489+ // Create an HTTPClient instance to communicate with the upload session's URL. Note that no bearer token is set here:
2490+ // oneDriveUploadSession.UploadUrl is a pre-authenticated, opaque URL with its own embedded access token, and Microsoft
2491+ // Graph rejects (some backends silently reject, others error) fragment uploads that also carry an Authorization header.
2492+ using ( var client = CreateHttpClient ( ) )
24942493 {
24952494 // Keep looping through the source file length until we've sent all bytes to the OneDrive webservice
24962495 while ( currentPosition < fileStream . Length )
Original file line number Diff line number Diff line change 22
33All notable changes to this project are documented in this file.
44
5+ ## [ 3.0.2.0]
6+
7+ - Fixed a potential issue with larger file uploads [ #49 ] ( https://github.com/KoenZomers/OneDriveAPI/pull/49 ) . Thanks YasarF!
8+
59## [ 3.0.1.0]
610
711### Fixed
You can’t perform that action at this time.
0 commit comments