Bug fix: empty key in DeleteMultipleObjects request caused bucket delete (#3939)

This commit is contained in:
pavelzhurov 2022-11-02 17:51:13 +05:00 committed by GitHub
parent 54d815fa04
commit abe4a61659
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -277,6 +277,9 @@ func (s3a *S3ApiServer) DeleteMultipleObjectsHandler(w http.ResponseWriter, r *h
// delete file entries // delete file entries
for _, object := range deleteObjects.Objects { for _, object := range deleteObjects.Objects {
if object.ObjectName == "" {
continue
}
lastSeparator := strings.LastIndex(object.ObjectName, "/") lastSeparator := strings.LastIndex(object.ObjectName, "/")
parentDirectoryPath, entryName, isDeleteData, isRecursive := "", object.ObjectName, true, false parentDirectoryPath, entryName, isDeleteData, isRecursive := "", object.ObjectName, true, false
if lastSeparator > 0 && lastSeparator+1 < len(object.ObjectName) { if lastSeparator > 0 && lastSeparator+1 < len(object.ObjectName) {