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: Fix remaining policy error handling in namespace and bucket handlers

Chris Lu2c45b6977591
diff --git a/weed/s3api/s3tables/handler_bucket_get_list_delete.go b/weed/s3api/s3tables/handler_bucket_get_list_delete.go
index 2a11313078..18d2eb7162 100644
--- a/weed/s3api/s3tables/handler_bucket_get_list_delete.go
+++ b/weed/s3api/s3tables/handler_bucket_get_list_delete.go
@@ -49,6 +49,8 @@ func (h *S3TablesHandler) handleGetTableBucket(w http.ResponseWriter, r *http.Re
policyData, err := h.getExtendedAttribute(r.Context(), client, bucketPath, ExtendedKeyPolicy)
if err == nil {
bucketPolicy = string(policyData)
+ } else if !errors.Is(err, ErrAttributeNotFound) {
+ return fmt.Errorf("failed to fetch bucket policy: %v", err)
}
return nil
diff --git a/weed/s3api/s3tables/handler_namespace.go b/weed/s3api/s3tables/handler_namespace.go
index 5e0e337876..de7dca2f73 100644
--- a/weed/s3api/s3tables/handler_namespace.go
+++ b/weed/s3api/s3tables/handler_namespace.go
@@ -59,6 +59,8 @@ func (h *S3TablesHandler) handleCreateNamespace(w http.ResponseWriter, r *http.R
policyData, err := h.getExtendedAttribute(r.Context(), client, bucketPath, ExtendedKeyPolicy)
if err == nil {
bucketPolicy = string(policyData)
+ } else if !errors.Is(err, ErrAttributeNotFound) {
+ return fmt.Errorf("failed to fetch bucket policy: %v", err)
}
return nil
@@ -182,6 +184,8 @@ func (h *S3TablesHandler) handleGetNamespace(w http.ResponseWriter, r *http.Requ
policyData, err := h.getExtendedAttribute(r.Context(), client, bucketPath, ExtendedKeyPolicy)
if err == nil {
bucketPolicy = string(policyData)
+ } else if !errors.Is(err, ErrAttributeNotFound) {
+ return fmt.Errorf("failed to fetch bucket policy: %v", err)
}
return nil
@@ -255,6 +259,8 @@ func (h *S3TablesHandler) handleListNamespaces(w http.ResponseWriter, r *http.Re
policyData, err := h.getExtendedAttribute(r.Context(), client, bucketPath, ExtendedKeyPolicy)
if err == nil {
bucketPolicy = string(policyData)
+ } else if !errors.Is(err, ErrAttributeNotFound) {
+ return fmt.Errorf("failed to fetch bucket policy: %v", err)
}
return nil
@@ -425,6 +431,8 @@ func (h *S3TablesHandler) handleDeleteNamespace(w http.ResponseWriter, r *http.R
policyData, err := h.getExtendedAttribute(r.Context(), client, bucketPath, ExtendedKeyPolicy)
if err == nil {
bucketPolicy = string(policyData)
+ } else if !errors.Is(err, ErrAttributeNotFound) {
+ return fmt.Errorf("failed to fetch bucket policy: %v", err)
}
return nil