mirror of
https://github.com/minio/minio.git
synced 2025-01-27 06:33:18 -05:00
Fix missing hash in GetObjectAttributes (#20231)
SHA256/SHA1 were mixed up. Simplify code as well.
This commit is contained in:
parent
89c58ce87d
commit
49055658a9
@ -762,21 +762,14 @@ func (api objectAPIHandlers) getObjectAttributesHandler(ctx context.Context, obj
|
|||||||
if _, ok := opts.ObjectAttributes[xhttp.Checksum]; ok {
|
if _, ok := opts.ObjectAttributes[xhttp.Checksum]; ok {
|
||||||
chkSums := objInfo.decryptChecksums(0, r.Header)
|
chkSums := objInfo.decryptChecksums(0, r.Header)
|
||||||
// AWS does not appear to append part number on this API call.
|
// AWS does not appear to append part number on this API call.
|
||||||
switch {
|
if len(chkSums) > 0 {
|
||||||
case chkSums["CRC32"] != "":
|
OA.Checksum = &objectAttributesChecksum{
|
||||||
OA.Checksum = new(objectAttributesChecksum)
|
ChecksumCRC32: strings.Split(chkSums["CRC32"], "-")[0],
|
||||||
OA.Checksum.ChecksumCRC32 = strings.Split(chkSums["CRC32"], "-")[0]
|
ChecksumCRC32C: strings.Split(chkSums["CRC32C"], "-")[0],
|
||||||
case chkSums["CRC32C"] != "":
|
ChecksumSHA1: strings.Split(chkSums["SHA1"], "-")[0],
|
||||||
OA.Checksum = new(objectAttributesChecksum)
|
ChecksumSHA256: strings.Split(chkSums["SHA256"], "-")[0],
|
||||||
OA.Checksum.ChecksumCRC32C = strings.Split(chkSums["CRC32C"], "-")[0]
|
}
|
||||||
case chkSums["SHA256"] != "":
|
|
||||||
OA.Checksum = new(objectAttributesChecksum)
|
|
||||||
OA.Checksum.ChecksumSHA1 = strings.Split(chkSums["SHA1"], "-")[0]
|
|
||||||
case chkSums["SHA1"] != "":
|
|
||||||
OA.Checksum = new(objectAttributesChecksum)
|
|
||||||
OA.Checksum.ChecksumSHA256 = strings.Split(chkSums["SHA256"], "-")[0]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := opts.ObjectAttributes[xhttp.ETag]; ok {
|
if _, ok := opts.ObjectAttributes[xhttp.ETag]; ok {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user