Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/duplicati/duplicati.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Duplicati/Library/Backend/OneDrive/MicrosoftGraphBackend.cs')
-rw-r--r--Duplicati/Library/Backend/OneDrive/MicrosoftGraphBackend.cs12
1 files changed, 5 insertions, 7 deletions
diff --git a/Duplicati/Library/Backend/OneDrive/MicrosoftGraphBackend.cs b/Duplicati/Library/Backend/OneDrive/MicrosoftGraphBackend.cs
index ac37027c1..95cf218d0 100644
--- a/Duplicati/Library/Backend/OneDrive/MicrosoftGraphBackend.cs
+++ b/Duplicati/Library/Backend/OneDrive/MicrosoftGraphBackend.cs
@@ -334,14 +334,14 @@ namespace Duplicati.Library.Backend
}
}
- public Task Put(string remotename, Stream stream, CancellationToken cancelToken)
+ public async Task Put(string remotename, Stream stream, CancellationToken cancelToken)
{
// PUT only supports up to 4 MB file uploads. There's a separate process for larger files.
if (stream.Length < PUT_MAX_SIZE)
{
StreamContent streamContent = new StreamContent(stream);
streamContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
- var response = this.m_client.PutAsync(string.Format("{0}/root:{1}{2}:/content", this.DrivePrefix, this.RootPath, NormalizeSlashes(remotename)), streamContent).Await();
+ var response = await m_client.PutAsync(string.Format("{0}/root:{1}{2}:/content", this.DrivePrefix, this.RootPath, NormalizeSlashes(remotename)), streamContent);
// Make sure this response is a valid drive item, though we don't actually use it for anything currently.
this.ParseResponse<DriveItem>(response);
@@ -358,7 +358,7 @@ namespace Duplicati.Library.Backend
// Indicate that we want to replace any existing content with this new data we're uploading
this.PrepareContent(new UploadSession() { Item = new DriveItem() { ConflictBehavior = ConflictBehavior.Replace } });
- HttpResponseMessage createSessionResponse = this.m_client.SendAsync(createSessionRequest).Await();
+ HttpResponseMessage createSessionResponse = await m_client.SendAsync(createSessionRequest);
UploadSession uploadSession = this.ParseResponse<UploadSession>(createSessionResponse);
// If the stream's total length is less than the chosen fragment size, then we should make the buffer only as large as the stream.
@@ -368,7 +368,7 @@ namespace Duplicati.Library.Backend
int read = 0;
for (int offset = 0; offset < stream.Length; offset += read)
{
- read = stream.Read(fragmentBuffer, 0, bufferSize);
+ read = await stream.ReadAsync(fragmentBuffer, 0, bufferSize, cancelToken);
int retryCount = this.fragmentRetryCount;
for (int attempt = 0; attempt < retryCount; attempt++)
@@ -384,7 +384,7 @@ namespace Duplicati.Library.Backend
try
{
// The uploaded put requests will error if they are authenticated
- response = this.m_client.SendAsync(request, false).Await();
+ response = await m_client.SendAsync(request, false);
// Note: On the last request, the json result includes the default properties of the item that was uploaded
this.ParseResponse<UploadSession>(response);
@@ -428,8 +428,6 @@ namespace Duplicati.Library.Backend
}
}
}
-
- return Task.FromResult(true);
}
public void Delete(string remotename)