From e9fede88b37f5f97f6b7f594e41c1d91e9c626eb Mon Sep 17 00:00:00 2001 From: Steven Reitsma Date: Tue, 30 Mar 2021 22:09:48 +0200 Subject: [PATCH] fix: multi delete when using S3 Gateway with SSE (#11929) --- cmd/gateway/s3/gateway-s3-sse.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cmd/gateway/s3/gateway-s3-sse.go b/cmd/gateway/s3/gateway-s3-sse.go index 66836b781..f6b8174ef 100644 --- a/cmd/gateway/s3/gateway-s3-sse.go +++ b/cmd/gateway/s3/gateway-s3-sse.go @@ -407,6 +407,20 @@ func (l *s3EncObjects) DeleteObject(ctx context.Context, bucket string, object s return l.deleteGWMetadata(ctx, bucket, getDareMetaPath(object)) } +func (l *s3EncObjects) DeleteObjects(ctx context.Context, bucket string, objects []minio.ObjectToDelete, opts minio.ObjectOptions) ([]minio.DeletedObject, []error) { + errs := make([]error, len(objects)) + dobjects := make([]minio.DeletedObject, len(objects)) + for idx, object := range objects { + _, errs[idx] = l.DeleteObject(ctx, bucket, object.ObjectName, opts) + if errs[idx] == nil { + dobjects[idx] = minio.DeletedObject{ + ObjectName: object.ObjectName, + } + } + } + return dobjects, errs +} + // ListMultipartUploads lists all multipart uploads. func (l *s3EncObjects) ListMultipartUploads(ctx context.Context, bucket string, prefix string, keyMarker string, uploadIDMarker string, delimiter string, maxUploads int) (lmi minio.ListMultipartsInfo, e error) {