From cd0e1ad14bf6deef18b343391064070e6dfc5b9d Mon Sep 17 00:00:00 2001 From: chrislu Date: Mon, 17 Nov 2025 02:17:45 -0800 Subject: [PATCH] always sort --- weed/s3api/s3api_object_handlers_list.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/weed/s3api/s3api_object_handlers_list.go b/weed/s3api/s3api_object_handlers_list.go index 614863a78..0b40d035e 100644 --- a/weed/s3api/s3api_object_handlers_list.go +++ b/weed/s3api/s3api_object_handlers_list.go @@ -351,9 +351,9 @@ func (s3a *S3ApiServer) listFilerEntries(bucket string, originalPrefix string, m Contents: contents, CommonPrefixes: commonPrefixes, } + // Sort CommonPrefixes lexicographically to match AWS S3 behavior + sort.Slice(response.CommonPrefixes, func(i, j int) bool { return response.CommonPrefixes[i].Prefix < response.CommonPrefixes[j].Prefix }) if encodingTypeUrl { - // Sort CommonPrefixes lexicographically to match AWS S3 behavior - sort.Slice(response.CommonPrefixes, func(i, j int) bool { return response.CommonPrefixes[i].Prefix < response.CommonPrefixes[j].Prefix }) response.EncodingType = s3.EncodingTypeUrl } return nil