aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--weed/s3api/s3api_object_handlers.go14
-rw-r--r--weed/s3api/s3api_object_handlers_list.go19
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 {