Browse Source

Sort CommonPrefixes lexicographically to match AWS S3 behavior

pull/7481/head
chrislu 3 weeks ago
parent
commit
7a9af53b45
  1. 4
      weed/s3api/s3api_object_handlers_list.go

4
weed/s3api/s3api_object_handlers_list.go

@ -355,6 +355,10 @@ func (s3a *S3ApiServer) listFilerEntries(bucket string, originalPrefix string, m
sort.Slice(response.CommonPrefixes, func(i, j int) bool { return response.CommonPrefixes[i].Prefix < response.CommonPrefixes[j].Prefix })
if encodingTypeUrl {
response.EncodingType = s3.EncodingTypeUrl
// URL-encode all common prefixes when EncodingType=url
for i := range response.CommonPrefixes {
response.CommonPrefixes[i].Prefix = urlPathEscape(response.CommonPrefixes[i].Prefix)
}
}
return nil
})

Loading…
Cancel
Save