This commit is contained in:
chrislu 2025-07-21 09:48:04 -07:00
parent 93720aab28
commit 65795f9bbb
2 changed files with 25 additions and 8 deletions

View File

@ -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{

View File

@ -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 {