[#515] Fix nil reference when a part is missing

Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
This commit is contained in:
Angira Kekteeva 2022-06-07 16:33:23 +04:00 committed by Alex Vanin
parent 93a7c2eaeb
commit 3f5afabd4a

View file

@ -340,7 +340,7 @@ func (n *layer) CompleteMultipartUpload(ctx context.Context, p *CompleteMultipar
var completedPartsHeader strings.Builder
for i, part := range p.Parts {
partInfo := partsInfo[part.PartNumber]
if part.ETag != partInfo.ETag {
if partInfo == nil || part.ETag != partInfo.ETag {
return nil, nil, errors.GetAPIError(errors.ErrInvalidPart)
}
// for the last part we have no minimum size limit