Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

s3: fix missing x-amz-meta-md5chksum headers for multipart uploads

Nick Craig-Woodb6e86b2c7fc1
diff --git a/backend/s3/s3.go b/backend/s3/s3.go
index 6bd950f91..e87e2cb08 100644
--- a/backend/s3/s3.go
+++ b/backend/s3/s3.go
@@ -2240,10 +2240,13 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
metaMtime: aws.String(swift.TimeToFloatString(modTime)),
}
- // read the md5sum if available for non multpart and if
- // disable checksum isn't present.
+ // read the md5sum if available
+ // - for non multpart
+ // - so we can add a ContentMD5
+ // - for multipart provided checksums aren't disabled
+ // - so we can add the md5sum in the metadata as metaMD5Hash
var md5sum string
- if !multipart && !o.fs.opt.DisableChecksum {
+ if !multipart || !o.fs.opt.DisableChecksum {
hash, err := src.Hash(ctx, hash.MD5)
if err == nil && matchMd5.MatchString(hash) {
hashBytes, err := hex.DecodeString(hash)