diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2025-07-20 14:15:25 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-20 14:15:25 -0700 |
| commit | 377f1f24c7782a647656da20c3e5096cba302b0b (patch) | |
| tree | 9258fbf28b48989c8c9c510863dfd418c98c33f2 /weed/s3api/s3api_bucket_config.go | |
| parent | 85036936d1e1faaaa9d3002372f549fc98a1f740 (diff) | |
| download | seaweedfs-377f1f24c7782a647656da20c3e5096cba302b0b.tar.xz seaweedfs-377f1f24c7782a647656da20c3e5096cba302b0b.zip | |
add basic object ACL (#7004)
* add back tests
* get put object acl
* check permission to put object acl
* rename file
* object list versions now contains owners
* set object owner
* refactoring
* Revert "add back tests"
This reverts commit 9adc507c45caafc5329433dba76f44c63318b0f1.
Diffstat (limited to 'weed/s3api/s3api_bucket_config.go')
| -rw-r--r-- | weed/s3api/s3api_bucket_config.go | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/weed/s3api/s3api_bucket_config.go b/weed/s3api/s3api_bucket_config.go index 5987a9de6..463587255 100644 --- a/weed/s3api/s3api_bucket_config.go +++ b/weed/s3api/s3api_bucket_config.go @@ -98,10 +98,11 @@ func (s3a *S3ApiServer) getBucketConfig(bucket string) (*BucketConfig, s3err.Err return config, s3err.ErrNone } - // Load from filer - bucketEntry, err := s3a.getEntry(s3a.option.BucketsPath, bucket) + // Try to get from filer + entry, err := s3a.getEntry(s3a.option.BucketsPath, bucket) if err != nil { - if err == filer_pb.ErrNotFound { + if errors.Is(err, filer_pb.ErrNotFound) { + // Bucket doesn't exist return nil, s3err.ErrNoSuchBucket } glog.Errorf("getBucketConfig: failed to get bucket entry for %s: %v", bucket, err) @@ -110,25 +111,25 @@ func (s3a *S3ApiServer) getBucketConfig(bucket string) (*BucketConfig, s3err.Err config := &BucketConfig{ Name: bucket, - Entry: bucketEntry, + Entry: entry, } // Extract configuration from extended attributes - if bucketEntry.Extended != nil { - if versioning, exists := bucketEntry.Extended[s3_constants.ExtVersioningKey]; exists { + if entry.Extended != nil { + if versioning, exists := entry.Extended[s3_constants.ExtVersioningKey]; exists { config.Versioning = string(versioning) } - if ownership, exists := bucketEntry.Extended[s3_constants.ExtOwnershipKey]; exists { + if ownership, exists := entry.Extended[s3_constants.ExtOwnershipKey]; exists { config.Ownership = string(ownership) } - if acl, exists := bucketEntry.Extended[s3_constants.ExtAmzAclKey]; exists { + if acl, exists := entry.Extended[s3_constants.ExtAmzAclKey]; exists { config.ACL = acl } - if owner, exists := bucketEntry.Extended[s3_constants.ExtAmzOwnerKey]; exists { + if owner, exists := entry.Extended[s3_constants.ExtAmzOwnerKey]; exists { config.Owner = string(owner) } // Parse Object Lock configuration if present - if objectLockConfig, found := LoadObjectLockConfigurationFromExtended(bucketEntry); found { + if objectLockConfig, found := LoadObjectLockConfigurationFromExtended(entry); found { config.ObjectLockConfig = objectLockConfig glog.V(2).Infof("getBucketConfig: cached Object Lock configuration for bucket %s", bucket) } |
