Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

Fix for DeleteMultipleObjectsHandler wrongly deleting parent folders (#6380)

Warren Hodgkinsona1a76ccb8c33
diff --git a/weed/s3api/s3api_object_handlers_delete.go b/weed/s3api/s3api_object_handlers_delete.go
index 7656b9d389..506e7609b5 100644
--- a/weed/s3api/s3api_object_handlers_delete.go
+++ b/weed/s3api/s3api_object_handlers_delete.go
@@ -3,12 +3,13 @@ package s3api
import (
"encoding/xml"
"fmt"
- "github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants"
- "golang.org/x/exp/slices"
"io"
"net/http"
"strings"
+ "github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants"
+ "golang.org/x/exp/slices"
+
"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/s3api/s3err"
@@ -157,6 +158,10 @@ func (s3a *S3ApiServer) DeleteMultipleObjectsHandler(w http.ResponseWriter, r *h
}
}
+ if s3a.option.AllowEmptyFolder {
+ return nil
+ }
+
// purge empty folders, only checking folders with deletions
for len(directoriesWithDeletion) > 0 {
directoriesWithDeletion = s3a.doDeleteEmptyDirectories(client, directoriesWithDeletion)