From abe4a6165912983c9e5785218bf9cdd73006094c Mon Sep 17 00:00:00 2001 From: pavelzhurov Date: Wed, 2 Nov 2022 17:51:13 +0500 Subject: [PATCH] Bug fix: empty key in DeleteMultipleObjects request caused bucket delete (#3939) --- weed/s3api/s3api_object_handlers.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.go index 6353fbb1e..d63a68e4b 100644 --- a/weed/s3api/s3api_object_handlers.go +++ b/weed/s3api/s3api_object_handlers.go @@ -277,6 +277,9 @@ func (s3a *S3ApiServer) DeleteMultipleObjectsHandler(w http.ResponseWriter, r *h // delete file entries for _, object := range deleteObjects.Objects { + if object.ObjectName == "" { + continue + } lastSeparator := strings.LastIndex(object.ObjectName, "/") parentDirectoryPath, entryName, isDeleteData, isRecursive := "", object.ObjectName, true, false if lastSeparator > 0 && lastSeparator+1 < len(object.ObjectName) {