s3: listObjectParts return ErrNoSuchUpload if does not exist

ubuntu@prod-master-1:~$ aws --endpoint http://10.244.15.66:8333 s3api abort-multipart-upload --bucket prod-cache --key multipart-test --upload-id 5347f936-6adc-43de-8e5c-1fd137c3b2bc
ubuntu@prod-master-1:~$ aws --endpoint http://10.244.15.66:8333 s3api list-parts --bucket prod-cache --key multipart-test --upload-id 5347f936-6adc-43de-8e5c-1fd137c3b2bc
{
    "Initiator": null,
    "Owner": null,
    "StorageClass": "STANDARD"
}

If we abort a multipart upload, it appears that records are left behind. We should get a 404 NoSuchKey error.
This commit is contained in:
chrislu 2022-02-03 12:34:16 -08:00
parent a7982bd525
commit 6cf2e7d493

View File

@ -270,6 +270,10 @@ func (s3a *S3ApiServer) listObjectParts(input *s3.ListPartsInput) (output *ListP
glog.Errorf("listObjectParts %s %s error: %v", *input.Bucket, *input.UploadId, err)
return nil, s3err.ErrNoSuchUpload
}
if len(entries) == 0 {
glog.Errorf("listObjectParts %s %s not found", *input.Bucket, *input.UploadId)
return nil, s3err.ErrNoSuchUpload
}
output.IsTruncated = aws.Bool(!isLast)