diff options
| author | crupest <crupest@outlook.com> | 2022-11-24 16:48:56 +0800 | 
|---|---|---|
| committer | crupest <crupest@outlook.com> | 2022-11-24 16:48:56 +0800 | 
| commit | 5ddb5cae0432b4f2e191adf91b266373743c81fe (patch) | |
| tree | ca0a4334dc84cf568635eb883a60c906ca2a0295 /docker/auto-backup/AutoBackup | |
| parent | 3e681bf273de228c84bf120e0061add38e4c6239 (diff) | |
| download | crupest-5ddb5cae0432b4f2e191adf91b266373743c81fe.tar.gz crupest-5ddb5cae0432b4f2e191adf91b266373743c81fe.tar.bz2 crupest-5ddb5cae0432b4f2e191adf91b266373743c81fe.zip  | |
Fix seek.
Diffstat (limited to 'docker/auto-backup/AutoBackup')
| -rw-r--r-- | docker/auto-backup/AutoBackup/TencentCloudCOS.cs | 4 | 
1 files changed, 3 insertions, 1 deletions
diff --git a/docker/auto-backup/AutoBackup/TencentCloudCOS.cs b/docker/auto-backup/AutoBackup/TencentCloudCOS.cs index c3d245c..ae96db4 100644 --- a/docker/auto-backup/AutoBackup/TencentCloudCOS.cs +++ b/docker/auto-backup/AutoBackup/TencentCloudCOS.cs @@ -160,7 +160,7 @@ public static class TencentCloudCOSHelper      public static async Task PutObject(Credentials credentials, string region, string bucket, string key, Stream dataStream)      { -        if (dataStream.CanSeek) +        if (!dataStream.CanSeek)          {              throw new ArgumentException("Data stream must be seekable.");          } @@ -170,6 +170,8 @@ public static class TencentCloudCOSHelper              throw new ArgumentException("Data stream must be smaller than 5GB.");          } +        dataStream.Seek(0, SeekOrigin.Begin); +          var host = GetHost(bucket, region);          var encodedKey = WebUtility.UrlEncode(key);          using var md5Handler = MD5.Create();  | 
