From c4e12dc846ca04c03cab9de69c828b1351631cfc Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Sat, 13 Feb 2021 18:48:25 +0100 Subject: [PATCH] fix: in MultiDelete API return MalformedXML upon empty input (#11532) To follow S3 spec --- cmd/bucket-handlers.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/bucket-handlers.go b/cmd/bucket-handlers.go index 8d8e5f0a6..649f67b8f 100644 --- a/cmd/bucket-handlers.go +++ b/cmd/bucket-handlers.go @@ -427,6 +427,12 @@ func (api objectAPIHandlers) DeleteMultipleObjectsHandler(w http.ResponseWriter, deleteObjectsFn = api.CacheAPI().DeleteObjects } + // Return Malformed XML as S3 spec if the list of objects is empty + if len(deleteObjects.Objects) == 0 { + writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrMalformedXML), r.URL, guessIsBrowserReq(r)) + return + } + var objectsToDelete = map[ObjectToDelete]int{} getObjectInfoFn := objectAPI.GetObjectInfo if api.CacheAPI() != nil {