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 | 8abde99c6d7b4d6af5a046f9812ea485fc225128 (patch) | |
tree | ca0a4334dc84cf568635eb883a60c906ca2a0295 /docker/auto-backup | |
parent | da2cfe11a274733718f9b26a78fae3994a33e037 (diff) | |
download | crupest-8abde99c6d7b4d6af5a046f9812ea485fc225128.tar.gz crupest-8abde99c6d7b4d6af5a046f9812ea485fc225128.tar.bz2 crupest-8abde99c6d7b4d6af5a046f9812ea485fc225128.zip |
Fix seek.
Diffstat (limited to 'docker/auto-backup')
-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(); |