diff --git a/weed/s3api/s3api_object_handlers_list.go b/weed/s3api/s3api_object_handlers_list.go index 1d9faa407..b1db5c61f 100644 --- a/weed/s3api/s3api_object_handlers_list.go +++ b/weed/s3api/s3api_object_handlers_list.go @@ -12,6 +12,7 @@ import ( "io" "net/http" "net/url" + "sort" "strconv" "strings" ) @@ -148,6 +149,7 @@ func (s3a *S3ApiServer) listFilerEntries(bucket string, originalPrefix string, m maxKeys: maxKeys, prefixEndsOnDelimiter: strings.HasSuffix(originalPrefix, "/") && len(originalMarker) == 0, } + // Todo remove force disable if s3a.option.AllowListRecursive && prefix == "force_disable" { err = s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error { @@ -274,6 +276,9 @@ func (s3a *S3ApiServer) listFilerEntries(bucket string, originalPrefix string, m CommonPrefixes: commonPrefixes, } if encodingTypeUrl { + sort.Slice(response.CommonPrefixes, func(i, j int) bool { + return response.CommonPrefixes[i].Prefix < response.CommonPrefixes[j].Prefix + }) response.EncodingType = s3.EncodingTypeUrl } return nil