diff options
author | Kenneth Skovhede <kenneth@hexad.dk> | 2021-08-11 11:35:31 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-11 11:35:31 +0300 |
commit | d40ba990ae5160ceefe6a76db01c269c46d228df (patch) | |
tree | dcc92f722b49cc8d64df08cb33a31652d6f1d787 | |
parent | 6dcbccab28bb7a50beb3a7a1631a80df44f6d88b (diff) | |
parent | de2a651763f7b3d46ea08c333d2df3a6a2e31fb3 (diff) |
Merge pull request #4557 from warwickmm/fix_putasync_implementations
Fix bug in PutAsync implementations
18 files changed, 46 insertions, 46 deletions
diff --git a/Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs b/Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs index 23d3a3f6c..3c99e48ac 100644 --- a/Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs +++ b/Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs @@ -30,8 +30,8 @@ using System.Security.Authentication; using System.Threading;
using System.Threading.Tasks;
using CoreUtility = Duplicati.Library.Utility.Utility;
-using Uri = System.Uri; - +using Uri = System.Uri;
+
namespace Duplicati.Library.Backend.AlternativeFTP
{
// ReSharper disable once RedundantExtendsListEntry
@@ -370,11 +370,11 @@ namespace Duplicati.Library.Backend.AlternativeFTP }
}
- public Task PutAsync(string remotename, string localname, CancellationToken cancelToken)
+ public async Task PutAsync(string remotename, string localname, CancellationToken cancelToken)
{
using (FileStream fs = File.Open(localname, FileMode.Open, FileAccess.Read, FileShare.Read))
{
- return PutAsync(remotename, fs, cancelToken);
+ await PutAsync(remotename, fs, cancelToken);
}
}
diff --git a/Duplicati/Library/Backend/AzureBlob/AzureBlobBackend.cs b/Duplicati/Library/Backend/AzureBlob/AzureBlobBackend.cs index 18ab0cc92..becf985c9 100644 --- a/Duplicati/Library/Backend/AzureBlob/AzureBlobBackend.cs +++ b/Duplicati/Library/Backend/AzureBlob/AzureBlobBackend.cs @@ -101,12 +101,12 @@ namespace Duplicati.Library.Backend.AzureBlob return _azureBlob.ListContainerEntries(); } - public Task PutAsync(string remotename, string localname, CancellationToken cancelToken) + public async Task PutAsync(string remotename, string localname, CancellationToken cancelToken) { using (var fs = File.Open(localname, FileMode.Open, FileAccess.Read, FileShare.Read)) { - return PutAsync(remotename, fs, cancelToken); + await PutAsync(remotename, fs, cancelToken); } } diff --git a/Duplicati/Library/Backend/Backblaze/B2.cs b/Duplicati/Library/Backend/Backblaze/B2.cs index d1e811d92..241cd7821 100644 --- a/Duplicati/Library/Backend/Backblaze/B2.cs +++ b/Duplicati/Library/Backend/Backblaze/B2.cs @@ -30,10 +30,10 @@ namespace Duplicati.Library.Backend.Backblaze public class B2 : IBackend, IStreamingBackend
{
private const string B2_ID_OPTION = "b2-accountid";
- private const string B2_KEY_OPTION = "b2-applicationkey"; - private const string B2_PAGESIZE_OPTION = "b2-page-size"; + private const string B2_KEY_OPTION = "b2-applicationkey";
+ private const string B2_PAGESIZE_OPTION = "b2-page-size";
private const string B2_DOWNLOAD_URL_OPTION = "b2-download-url";
- +
private const string B2_CREATE_BUCKET_TYPE_OPTION = "b2-create-bucket-type";
private const string DEFAULT_BUCKET_TYPE = "allPrivate";
@@ -95,9 +95,9 @@ namespace Duplicati.Library.Backend.Backblaze if (string.IsNullOrEmpty(accountKey))
throw new UserInformationException(Strings.B2.NoB2KeyError, "B2MissingKey");
- m_helper = new B2AuthHelper(accountId, accountKey); - - m_pagesize = DEFAULT_PAGE_SIZE; + m_helper = new B2AuthHelper(accountId, accountKey);
+
+ m_pagesize = DEFAULT_PAGE_SIZE;
if (options.ContainsKey(B2_PAGESIZE_OPTION))
{
int.TryParse(options[B2_PAGESIZE_OPTION], out m_pagesize);
@@ -182,8 +182,8 @@ namespace Duplicati.Library.Backend.Backblaze new CommandLineArgument(B2_KEY_OPTION, CommandLineArgument.ArgumentType.Password, Strings.B2.B2applicationkeyDescriptionShort, Strings.B2.B2applicationkeyDescriptionLong, null, new string[] {"auth-username"}, null),
new CommandLineArgument("auth-password", CommandLineArgument.ArgumentType.Password, Strings.B2.AuthPasswordDescriptionShort, Strings.B2.AuthPasswordDescriptionLong),
new CommandLineArgument("auth-username", CommandLineArgument.ArgumentType.String, Strings.B2.AuthUsernameDescriptionShort, Strings.B2.AuthUsernameDescriptionLong),
- new CommandLineArgument(B2_CREATE_BUCKET_TYPE_OPTION, CommandLineArgument.ArgumentType.String, Strings.B2.B2createbuckettypeDescriptionShort, Strings.B2.B2createbuckettypeDescriptionLong, DEFAULT_BUCKET_TYPE), - new CommandLineArgument(B2_PAGESIZE_OPTION, CommandLineArgument.ArgumentType.Integer, Strings.B2.B2pagesizeDescriptionShort, Strings.B2.B2pagesizeDescriptionLong, DEFAULT_PAGE_SIZE.ToString()), + new CommandLineArgument(B2_CREATE_BUCKET_TYPE_OPTION, CommandLineArgument.ArgumentType.String, Strings.B2.B2createbuckettypeDescriptionShort, Strings.B2.B2createbuckettypeDescriptionLong, DEFAULT_BUCKET_TYPE),
+ new CommandLineArgument(B2_PAGESIZE_OPTION, CommandLineArgument.ArgumentType.Integer, Strings.B2.B2pagesizeDescriptionShort, Strings.B2.B2pagesizeDescriptionLong, DEFAULT_PAGE_SIZE.ToString()),
new CommandLineArgument(B2_DOWNLOAD_URL_OPTION, CommandLineArgument.ArgumentType.String, Strings.B2.B2downloadurlDescriptionShort, Strings.B2.B2downloadurlDescriptionLong),
});
@@ -362,10 +362,10 @@ namespace Duplicati.Library.Backend.Backblaze ).ToList();
}
- public Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
+ public async Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
{
using (System.IO.FileStream fs = System.IO.File.OpenRead(filename))
- return PutAsync(remotename, fs, cancelToken);
+ await PutAsync(remotename, fs, cancelToken);
}
public void Get(string remotename, string filename)
diff --git a/Duplicati/Library/Backend/Box/BoxBackend.cs b/Duplicati/Library/Backend/Box/BoxBackend.cs index 03d6f6bb0..acc725d20 100644 --- a/Duplicati/Library/Backend/Box/BoxBackend.cs +++ b/Duplicati/Library/Backend/Box/BoxBackend.cs @@ -260,10 +260,10 @@ namespace Duplicati.Library.Backend.Box select (IFileEntry)new FileEntry(n.Name, n.Size, n.ModifiedAt, n.ModifiedAt) { IsFolder = n.Type == "folder" };
}
- public Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
+ public async Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
{
using (System.IO.FileStream fs = System.IO.File.OpenRead(filename))
- return PutAsync(remotename, fs, cancelToken);
+ await PutAsync(remotename, fs, cancelToken);
}
public void Get(string remotename, string filename)
diff --git a/Duplicati/Library/Backend/CloudFiles/CloudFiles.cs b/Duplicati/Library/Backend/CloudFiles/CloudFiles.cs index ece4510e7..f53c40e78 100644 --- a/Duplicati/Library/Backend/CloudFiles/CloudFiles.cs +++ b/Duplicati/Library/Backend/CloudFiles/CloudFiles.cs @@ -194,10 +194,10 @@ namespace Duplicati.Library.Backend } while (repeat);
}
- public Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
+ public async Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
{
using (System.IO.FileStream fs = System.IO.File.OpenRead(filename))
- return PutAsync(remotename, fs, cancelToken);
+ await PutAsync(remotename, fs, cancelToken);
}
public void Get(string remotename, string filename)
diff --git a/Duplicati/Library/Backend/Dropbox/Dropbox.cs b/Duplicati/Library/Backend/Dropbox/Dropbox.cs index 835deb38b..89ea8b863 100644 --- a/Duplicati/Library/Backend/Dropbox/Dropbox.cs +++ b/Duplicati/Library/Backend/Dropbox/Dropbox.cs @@ -107,10 +107,10 @@ namespace Duplicati.Library.Backend }
}
- public Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
+ public async Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
{
using(FileStream fs = File.OpenRead(filename))
- return PutAsync(remotename, fs, cancelToken);
+ await PutAsync(remotename, fs, cancelToken);
}
public void Get(string remotename, string filename)
diff --git a/Duplicati/Library/Backend/FTP/FTPBackend.cs b/Duplicati/Library/Backend/FTP/FTPBackend.cs index e5c2bbc2e..cabffc9dc 100644 --- a/Duplicati/Library/Backend/FTP/FTPBackend.cs +++ b/Duplicati/Library/Backend/FTP/FTPBackend.cs @@ -296,10 +296,10 @@ namespace Duplicati.Library.Backend }
}
- public Task PutAsync(string remotename, string localname, CancellationToken cancelToken)
+ public async Task PutAsync(string remotename, string localname, CancellationToken cancelToken)
{
using (System.IO.FileStream fs = System.IO.File.Open(localname, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read))
- return PutAsync(remotename, fs, cancelToken);
+ await PutAsync(remotename, fs, cancelToken);
}
public void Get(string remotename, System.IO.Stream output)
diff --git a/Duplicati/Library/Backend/GoogleServices/GoogleCloudStorage.cs b/Duplicati/Library/Backend/GoogleServices/GoogleCloudStorage.cs index 1c63f0e06..65f744969 100644 --- a/Duplicati/Library/Backend/GoogleServices/GoogleCloudStorage.cs +++ b/Duplicati/Library/Backend/GoogleServices/GoogleCloudStorage.cs @@ -139,10 +139,10 @@ namespace Duplicati.Library.Backend.GoogleCloudStorage }
}
- public Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
+ public async Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
{
using (System.IO.FileStream fs = System.IO.File.OpenRead(filename))
- return PutAsync(remotename, fs, cancelToken);
+ await PutAsync(remotename, fs, cancelToken);
}
public void Get(string remotename, string filename)
diff --git a/Duplicati/Library/Backend/GoogleServices/GoogleDrive.cs b/Duplicati/Library/Backend/GoogleServices/GoogleDrive.cs index 29e179e50..bee4df367 100644 --- a/Duplicati/Library/Backend/GoogleServices/GoogleDrive.cs +++ b/Duplicati/Library/Backend/GoogleServices/GoogleDrive.cs @@ -253,10 +253,10 @@ namespace Duplicati.Library.Backend.GoogleDrive }
}
- public Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
+ public async Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
{
using (System.IO.FileStream fs = System.IO.File.OpenRead(filename))
- return PutAsync(remotename, fs, cancelToken);
+ await PutAsync(remotename, fs, cancelToken);
}
public void Get(string remotename, string filename)
diff --git a/Duplicati/Library/Backend/Jottacloud/Jottacloud.cs b/Duplicati/Library/Backend/Jottacloud/Jottacloud.cs index 95dc2762f..9f297abf2 100644 --- a/Duplicati/Library/Backend/Jottacloud/Jottacloud.cs +++ b/Duplicati/Library/Backend/Jottacloud/Jottacloud.cs @@ -304,10 +304,10 @@ namespace Duplicati.Library.Backend return ToFileEntry(xFile); } - public Task PutAsync(string remotename, string filename, CancellationToken cancelToken) + public async Task PutAsync(string remotename, string filename, CancellationToken cancelToken) { using (System.IO.FileStream fs = System.IO.File.OpenRead(filename)) - return PutAsync(remotename, fs, cancelToken); + await PutAsync(remotename, fs, cancelToken); } public void Get(string remotename, string filename) diff --git a/Duplicati/Library/Backend/Mega/MegaBackend.cs b/Duplicati/Library/Backend/Mega/MegaBackend.cs index c3878b1e1..8f73cf2a4 100644 --- a/Duplicati/Library/Backend/Mega/MegaBackend.cs +++ b/Duplicati/Library/Backend/Mega/MegaBackend.cs @@ -196,10 +196,10 @@ namespace Duplicati.Library.Backend.Mega select new FileEntry(item.Name, item.Size, item.ModificationDate ?? new DateTime(0), item.ModificationDate ?? new DateTime(0));
}
- public Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
+ public async Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
{
using (System.IO.FileStream fs = System.IO.File.OpenRead(filename))
- return PutAsync(remotename, fs, cancelToken);
+ await PutAsync(remotename, fs, cancelToken);
}
public void Get(string remotename, string filename)
diff --git a/Duplicati/Library/Backend/OpenStack/OpenStackStorage.cs b/Duplicati/Library/Backend/OpenStack/OpenStackStorage.cs index 306aa9087..935645c3b 100644 --- a/Duplicati/Library/Backend/OpenStack/OpenStackStorage.cs +++ b/Duplicati/Library/Backend/OpenStack/OpenStackStorage.cs @@ -565,10 +565,10 @@ namespace Duplicati.Library.Backend.OpenStack }
}
- public Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
+ public async Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
{
using (FileStream fs = File.OpenRead(filename))
- return PutAsync(remotename, fs, cancelToken);
+ await PutAsync(remotename, fs, cancelToken);
}
public void Get(string remotename, string filename)
diff --git a/Duplicati/Library/Backend/S3/S3Backend.cs b/Duplicati/Library/Backend/S3/S3Backend.cs index 6b14eabbf..cde4dbf23 100644 --- a/Duplicati/Library/Backend/S3/S3Backend.cs +++ b/Duplicati/Library/Backend/S3/S3Backend.cs @@ -341,10 +341,10 @@ namespace Duplicati.Library.Backend }
}
- public Task PutAsync(string remotename, string localname, CancellationToken cancelToken)
+ public async Task PutAsync(string remotename, string localname, CancellationToken cancelToken)
{
using (FileStream fs = File.Open(localname, FileMode.Open, FileAccess.Read, FileShare.Read))
- return PutAsync(remotename, fs, cancelToken);
+ await PutAsync(remotename, fs, cancelToken);
}
public async Task PutAsync(string remotename, Stream input, CancellationToken cancelToken)
diff --git a/Duplicati/Library/Backend/SSHv2/SSHv2Backend.cs b/Duplicati/Library/Backend/SSHv2/SSHv2Backend.cs index 14bb5264a..5e79a6db9 100644 --- a/Duplicati/Library/Backend/SSHv2/SSHv2Backend.cs +++ b/Duplicati/Library/Backend/SSHv2/SSHv2Backend.cs @@ -167,11 +167,11 @@ namespace Duplicati.Library.Backend public string ProtocolKey => "ssh";
- public Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
+ public async Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
{
using (System.IO.FileStream fs = System.IO.File.Open(filename, System.IO.FileMode.Open,
System.IO.FileAccess.Read, System.IO.FileShare.Read))
- return PutAsync(remotename, fs, cancelToken);
+ await PutAsync(remotename, fs, cancelToken);
}
public void Get(string remotename, string filename)
diff --git a/Duplicati/Library/Backend/SharePoint/SharePointBackend.cs b/Duplicati/Library/Backend/SharePoint/SharePointBackend.cs index c0af18060..646471669 100644 --- a/Duplicati/Library/Backend/SharePoint/SharePointBackend.cs +++ b/Duplicati/Library/Backend/SharePoint/SharePointBackend.cs @@ -518,10 +518,10 @@ namespace Duplicati.Library.Backend Utility.Utility.CopyStream(s, stream, true, copybuffer); } - public Task PutAsync(string remotename, string filename, CancellationToken cancelToken) + public async Task PutAsync(string remotename, string filename, CancellationToken cancelToken) { using (FileStream fs = System.IO.File.OpenRead(filename)) - return PutAsync(remotename, fs, cancelToken); + await PutAsync(remotename, fs, cancelToken); } public Task PutAsync(string remotename, Stream stream, CancellationToken cancelToken) { return doPut(remotename, stream, false, cancelToken); } diff --git a/Duplicati/Library/Backend/TahoeLAFS/TahoeBackend.cs b/Duplicati/Library/Backend/TahoeLAFS/TahoeBackend.cs index e36e03ce9..b35ad4585 100644 --- a/Duplicati/Library/Backend/TahoeLAFS/TahoeBackend.cs +++ b/Duplicati/Library/Backend/TahoeLAFS/TahoeBackend.cs @@ -209,10 +209,10 @@ namespace Duplicati.Library.Backend }
}
- public Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
+ public async Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
{
using (System.IO.FileStream fs = System.IO.File.OpenRead(filename))
- return PutAsync(remotename, fs, cancelToken);
+ await PutAsync(remotename, fs, cancelToken);
}
public void Get(string remotename, string filename)
diff --git a/Duplicati/Library/Backend/TencentCOS/COSBackend.cs b/Duplicati/Library/Backend/TencentCOS/COSBackend.cs index 59d5a719b..5951c50b3 100644 --- a/Duplicati/Library/Backend/TencentCOS/COSBackend.cs +++ b/Duplicati/Library/Backend/TencentCOS/COSBackend.cs @@ -196,10 +196,10 @@ namespace Duplicati.Library.Backend.TencentCOS } } - public Task PutAsync(string remotename, string filename, CancellationToken cancelToken) + public async Task PutAsync(string remotename, string filename, CancellationToken cancelToken) { using (FileStream fs = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read)) - return PutAsync(remotename, fs, cancelToken); + await PutAsync(remotename, fs, cancelToken); } public void Get(string remotename, string filename) diff --git a/Duplicati/Library/Backend/WEBDAV/WEBDAV.cs b/Duplicati/Library/Backend/WEBDAV/WEBDAV.cs index 5e1f0b205..1f40b8f00 100644 --- a/Duplicati/Library/Backend/WEBDAV/WEBDAV.cs +++ b/Duplicati/Library/Backend/WEBDAV/WEBDAV.cs @@ -256,10 +256,10 @@ namespace Duplicati.Library.Backend return files;
}
- public Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
+ public async Task PutAsync(string remotename, string filename, CancellationToken cancelToken)
{
using (System.IO.FileStream fs = System.IO.File.OpenRead(filename))
- return PutAsync(remotename, fs, cancelToken);
+ await PutAsync(remotename, fs, cancelToken);
}
public void Get(string remotename, string filename)
|