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: Remove duplicate bucket extraction logic in helper

Chris Luc99e8d41525b
diff --git a/weed/s3api/s3tables/handler_policy.go b/weed/s3api/s3tables/handler_policy.go
index 93fb3673f8..fd2537d740 100644
--- a/weed/s3api/s3tables/handler_policy.go
+++ b/weed/s3api/s3tables/handler_policy.go
@@ -18,30 +18,24 @@ func (h *S3TablesHandler) extractResourceOwnerAndBucket(
resourcePath string,
rType ResourceType,
) (ownerAccountID, bucketName string, err error) {
+ // Extract bucket name from resource path (format: /tables/{bucket}/... for both tables and buckets)
+ parts := strings.Split(strings.Trim(resourcePath, "/"), "/")
+ if len(parts) >= 2 {
+ bucketName = parts[1]
+ }
+
if rType == ResourceTypeTable {
var meta tableMetadataInternal
if err := json.Unmarshal(data, &meta); err != nil {
return "", "", err
}
ownerAccountID = meta.OwnerAccountID
- // Extract bucket name from resource path for tables
- // resourcePath format: /tables/{bucket}/{namespace}/{table}
- parts := strings.Split(strings.Trim(resourcePath, "/"), "/")
- if len(parts) >= 2 {
- bucketName = parts[1]
- }
} else {
var meta tableBucketMetadata
if err := json.Unmarshal(data, &meta); err != nil {
return "", "", err
}
ownerAccountID = meta.OwnerAccountID
- // Extract bucket name from resource path for buckets
- // resourcePath format: /tables/{bucket}
- parts := strings.Split(strings.Trim(resourcePath, "/"), "/")
- if len(parts) >= 2 {
- bucketName = parts[1]
- }
}
return ownerAccountID, bucketName, nil
}