mirror of
https://github.com/minio/minio.git
synced 2025-11-07 04:42:56 -05:00
fix: invalid checksum on site replication with conforming checksum types (#21535)
This commit is contained in:
@@ -3797,14 +3797,13 @@ func getCRCMeta(oi ObjectInfo, partNum int, h http.Header) (cs map[string]string
|
||||
meta := make(map[string]string)
|
||||
cs, isMP = oi.decryptChecksums(partNum, h)
|
||||
for k, v := range cs {
|
||||
cksum := hash.NewChecksumString(k, v)
|
||||
if cksum == nil {
|
||||
if k == xhttp.AmzChecksumType {
|
||||
continue
|
||||
}
|
||||
if cksum.Valid() {
|
||||
meta[cksum.Type.Key()] = v
|
||||
meta[xhttp.AmzChecksumType] = cs[xhttp.AmzChecksumType]
|
||||
meta[xhttp.AmzChecksumAlgo] = cksum.Type.String()
|
||||
cktype := hash.ChecksumStringToType(k)
|
||||
if cktype.IsSet() {
|
||||
meta[cktype.Key()] = v
|
||||
meta[xhttp.AmzChecksumAlgo] = cktype.String()
|
||||
}
|
||||
}
|
||||
return meta, isMP
|
||||
|
||||
@@ -1161,6 +1161,7 @@ func (er erasureObjects) CompleteMultipartUpload(ctx context.Context, bucket str
|
||||
Err: fmt.Errorf("checksum type mismatch. got %q (%s) expected %q (%s)", checksumType.String(), checksumType.ObjType(), opts.WantChecksum.Type.String(), opts.WantChecksum.Type.ObjType()),
|
||||
}
|
||||
}
|
||||
checksumType |= hash.ChecksumMultipart | hash.ChecksumIncludesMultipart
|
||||
}
|
||||
|
||||
var checksumCombined []byte
|
||||
|
||||
@@ -221,6 +221,10 @@ func (api objectAPIHandlers) NewMultipartUploadHandler(w http.ResponseWriter, r
|
||||
opts.WantChecksum = &hash.Checksum{Type: checksumType}
|
||||
}
|
||||
|
||||
if opts.WantChecksum != nil {
|
||||
opts.WantChecksum.Type |= hash.ChecksumMultipart | hash.ChecksumIncludesMultipart
|
||||
}
|
||||
|
||||
newMultipartUpload := objectAPI.NewMultipartUpload
|
||||
|
||||
res, err := newMultipartUpload(ctx, bucket, object, opts)
|
||||
|
||||
Reference in New Issue
Block a user