diff options
| author | chrislu <chris.lu@gmail.com> | 2025-07-21 09:48:04 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2025-07-21 09:48:04 -0700 |
| commit | 65795f9bbbcce22a4ec7591806502bad267e91f5 (patch) | |
| tree | a090f099ab9f85808b76ecfe678e0807b10435b9 | |
| parent | 93720aab282b38401f0b3b1f20d6dd7d44d2a90d (diff) | |
| download | seaweedfs-65795f9bbbcce22a4ec7591806502bad267e91f5.tar.xz seaweedfs-65795f9bbbcce22a4ec7591806502bad267e91f5.zip | |
| -rw-r--r-- | weed/s3api/s3api_object_handlers.go | 14 | ||||
| -rw-r--r-- | weed/s3api/s3api_object_handlers_list.go | 19 |
2 files changed, 25 insertions, 8 deletions
diff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.go index bfaeb568b..fbd3d1011 100644 --- a/weed/s3api/s3api_object_handlers.go +++ b/weed/s3api/s3api_object_handlers.go @@ -211,15 +211,13 @@ func newListEntry(entry *filer_pb.Entry, key string, dir string, name string, bu 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 - } + // Use the ownerID as displayName if no better option is available + displayName = ownerID - // Additional fallback to file system username if available and no display name resolved - if displayName == "unknown" && entry.Attributes.UserName != "" { - displayName = entry.Attributes.UserName + // Additional fallback to file system username if available and different from ownerID + if entry.Attributes.UserName != "" && entry.Attributes.UserName != ownerID { + displayName = entry.Attributes.UserName + } } listEntry.Owner = CanonicalUser{ diff --git a/weed/s3api/s3api_object_handlers_list.go b/weed/s3api/s3api_object_handlers_list.go index 0e9e58c40..fb729e8e9 100644 --- a/weed/s3api/s3api_object_handlers_list.go +++ b/weed/s3api/s3api_object_handlers_list.go @@ -148,6 +148,25 @@ func (s3a *S3ApiServer) listFilerEntries(bucket string, originalPrefix string, m prefixEndsOnDelimiter: strings.HasSuffix(originalPrefix, "/") && len(originalMarker) == 0, } + // Special case: when maxKeys = 0, return empty results immediately + if maxKeys == 0 { + response = ListBucketResult{ + Name: bucket, + Prefix: originalPrefix, + Marker: originalMarker, + NextMarker: "", + MaxKeys: int(maxKeys), + Delimiter: delimiter, + IsTruncated: false, + Contents: contents, + CommonPrefixes: commonPrefixes, + } + if encodingTypeUrl { + response.EncodingType = s3.EncodingTypeUrl + } + return + } + // check filer err = s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error { for { |
