isMultipart to test on parts sizes only if object is encrypted (#13839)

ObjectInfo.isMultipart() is testing if parts sizes are compatible with
encrypted parts but this only can be done if the object is encrypted.
This commit is contained in:
Anis Elleuch 2021-12-06 18:43:43 +01:00 committed by GitHub
parent b120bcb60a
commit f286ef8e17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,7 +91,8 @@ func (o *ObjectInfo) isMultipart() bool {
return false
}
_, encrypted := crypto.IsEncrypted(o.UserDefined)
if encrypted && !crypto.IsMultiPart(o.UserDefined) {
if encrypted {
if !crypto.IsMultiPart(o.UserDefined) {
return false
}
for _, part := range o.Parts {
@ -100,6 +101,8 @@ func (o *ObjectInfo) isMultipart() bool {
return false
}
}
}
// Further check if this object is uploaded using multipart mechanism
// by the user and it is not about Erasure internally splitting the
// object into parts in PutObject()