Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Api/OneDriveGraphApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2468,9 +2468,6 @@ protected virtual async Task<OneDriveItem> UploadFileViaResumableUploadInternal(
throw new ArgumentNullException("oneDriveUploadSession");
}

// Get an access token to perform the request to OneDrive
var accessToken = await GetAccessToken();

// Amount of bytes succesfully sent
long totalBytesSent = 0;

Expand All @@ -2489,8 +2486,10 @@ protected virtual async Task<OneDriveItem> UploadFileViaResumableUploadInternal(
// Defines a buffer which will be filled with bytes from the original file and then sent off to the OneDrive webservice
var fragmentBuffer = new byte[fragmentSizeInBytes ?? ResumableUploadChunkSizeInBytes];

// Create an HTTPClient instance to communicate with the REST API of OneDrive to perform the upload
using (var client = CreateHttpClient(accessToken.AccessToken))
// Create an HTTPClient instance to communicate with the upload session's URL. Note that no bearer token is set here:
// oneDriveUploadSession.UploadUrl is a pre-authenticated, opaque URL with its own embedded access token, and Microsoft
// Graph rejects (some backends silently reject, others error) fragment uploads that also carry an Authorization header.
using (var client = CreateHttpClient())
{
// Keep looping through the source file length until we've sent all bytes to the OneDrive webservice
while (currentPosition < fileStream.Length)
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project are documented in this file.

## [3.0.2.0]

- Fixed a potential issue with larger file uploads [#49](https://github.com/KoenZomers/OneDriveAPI/pull/49). Thanks YasarF!

## [3.0.1.0]

### Fixed
Expand Down
Loading