aboutsummaryrefslogtreecommitdiff
path: root/weed/s3api/s3api_object_handlers.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2025-07-21 00:23:22 -0700
committerGitHub <noreply@github.com>2025-07-21 00:23:22 -0700
commitc196d03951a75d3b8976f556cb0400e5b522edeb (patch)
tree21618d3645e44fd763648067b1db900cd3fa985e /weed/s3api/s3api_object_handlers.go
parentbfe68984d5b5dff29083aeb6f79401a530feb510 (diff)
downloadseaweedfs-c196d03951a75d3b8976f556cb0400e5b522edeb.tar.xz
seaweedfs-c196d03951a75d3b8976f556cb0400e5b522edeb.zip
fix listing object versions (#7006)
* fix listing object versions * Update s3api_object_versioning.go * Update s3_directory_versioning_test.go * check previous skipped tests * fix test_versioning_stack_delete_merkers * address test_bucket_list_return_data_versioning * Update s3_directory_versioning_test.go * fix test_versioning_concurrent_multi_object_delete * fix test_versioning_obj_suspend_versions test * fix empty owner * fix listing versioned objects * default owner * fix path
Diffstat (limited to 'weed/s3api/s3api_object_handlers.go')
-rw-r--r--weed/s3api/s3api_object_handlers.go28
1 files changed, 26 insertions, 2 deletions
diff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.go
index 77863acfe..bfaeb568b 100644
--- a/weed/s3api/s3api_object_handlers.go
+++ b/weed/s3api/s3api_object_handlers.go
@@ -198,9 +198,33 @@ func newListEntry(entry *filer_pb.Entry, key string, dir string, name string, bu
StorageClass: StorageClass(storageClass),
}
if fetchOwner {
+ // Extract owner from S3 metadata (Extended attributes) instead of file system attributes
+ var ownerID, displayName string
+ if entry.Extended != nil {
+ if ownerBytes, exists := entry.Extended[s3_constants.ExtAmzOwnerKey]; exists {
+ ownerID = string(ownerBytes)
+ }
+ }
+
+ // Fallback to anonymous if no S3 owner found
+ if ownerID == "" {
+ ownerID = s3_constants.AccountAnonymousId
+ displayName = "anonymous"
+ } else {
+ // Try to resolve display name from IAM system
+ displayName = "unknown"
+ // Note: IAM resolution would require access to the S3ApiServer instance
+ // For now, use a simple fallback or could be enhanced later
+ }
+
+ // Additional fallback to file system username if available and no display name resolved
+ if displayName == "unknown" && entry.Attributes.UserName != "" {
+ displayName = entry.Attributes.UserName
+ }
+
listEntry.Owner = CanonicalUser{
- ID: fmt.Sprintf("%x", entry.Attributes.Uid),
- DisplayName: entry.Attributes.UserName,
+ ID: ownerID,
+ DisplayName: displayName,
}
}
return listEntry