From 3094fa72e8d1985528cfc0c8835ac0f01e15b2c7 Mon Sep 17 00:00:00 2001 From: jojoliang Date: Mon, 12 Apr 2021 21:43:21 +0800 Subject: [PATCH] update ces-kms --- crypto/crypto_object_part.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crypto/crypto_object_part.go b/crypto/crypto_object_part.go index 15561b4..f7b1410 100644 --- a/crypto/crypto_object_part.go +++ b/crypto/crypto_object_part.go @@ -40,7 +40,10 @@ func (s *CryptoObjectService) InitiateMultipartUpload(ctx context.Context, name opt.XOptionHeader.Add(COSClientSideEncryptionUnencryptedContentMD5, opt.ContentMD5) opt.ContentMD5 = "" } - opt.XOptionHeader.Add(COSClientSideEncryptionUnencryptedContentLength, strconv.FormatInt(cryptoCtx.DataSize, 10)) + if cryptoCtx.DataSize > 0 { + opt.XOptionHeader.Add(COSClientSideEncryptionDataSize, strconv.FormatInt(cryptoCtx.DataSize, 10)) + } + opt.XOptionHeader.Add(COSClientSideEncryptionPartSize, strconv.FormatInt(cryptoCtx.PartSize, 10)) addCryptoHeaders(opt.XOptionHeader, contentCipher.GetCipherData()) return s.ObjectService.InitiateMultipartUpload(ctx, name, opt)