diff options
| -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();  | 
