From f286ef8e17a9d694c52b9bdee47164d3dcc82ad3 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Mon, 6 Dec 2021 18:43:43 +0100 Subject: [PATCH] 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. --- cmd/encryption-v1.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cmd/encryption-v1.go b/cmd/encryption-v1.go index dc9a7c9ab..f2b4d1a9b 100644 --- a/cmd/encryption-v1.go +++ b/cmd/encryption-v1.go @@ -91,15 +91,18 @@ func (o *ObjectInfo) isMultipart() bool { return false } _, encrypted := crypto.IsEncrypted(o.UserDefined) - if encrypted && !crypto.IsMultiPart(o.UserDefined) { - return false - } - for _, part := range o.Parts { - _, err := sio.DecryptedSize(uint64(part.Size)) - if err != nil { + if encrypted { + if !crypto.IsMultiPart(o.UserDefined) { return false } + for _, part := range o.Parts { + _, err := sio.DecryptedSize(uint64(part.Size)) + if err != nil { + 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()