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.

s3tables: improve bucket policy error handling in DeleteTableBucket

Chris Lu745a7e40a689
diff --git a/weed/s3api/s3tables/handler_bucket_get_list_delete.go b/weed/s3api/s3tables/handler_bucket_get_list_delete.go
index 18d2eb7162..3278346670 100644
--- a/weed/s3api/s3tables/handler_bucket_get_list_delete.go
+++ b/weed/s3api/s3tables/handler_bucket_get_list_delete.go
@@ -257,7 +257,13 @@ func (h *S3TablesHandler) handleDeleteTableBucket(w http.ResponseWriter, r *http
// Fetch bucket policy if it exists
policyData, err := h.getExtendedAttribute(r.Context(), client, bucketPath, ExtendedKeyPolicy)
- if err == nil {
+ if err != nil {
+ if errors.Is(err, ErrAttributeNotFound) {
+ // No bucket policy set; proceed with empty bucketPolicy
+ } else {
+ return fmt.Errorf("failed to fetch bucket policy: %w", err)
+ }
+ } else {
bucketPolicy = string(policyData)
}