Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

sort lifecycles

chrislu78069605a615
diff --git a/weed/s3api/s3api_bucket_handlers.go b/weed/s3api/s3api_bucket_handlers.go
index 2f535d0d0b..52470e7df5 100644
--- a/weed/s3api/s3api_bucket_handlers.go
+++ b/weed/s3api/s3api_bucket_handlers.go
@@ -8,6 +8,7 @@ import (
"fmt"
"math"
"net/http"
+ "sort"
"strings"
"time"
@@ -329,7 +330,15 @@ func (s3a *S3ApiServer) GetBucketLifecycleConfigurationHandler(w http.ResponseWr
}
response := Lifecycle{}
- for locationPrefix, internalTtl := range ttls {
+ // Sort locationPrefixes to ensure consistent ordering of lifecycle rules
+ var locationPrefixes []string
+ for locationPrefix := range ttls {
+ locationPrefixes = append(locationPrefixes, locationPrefix)
+ }
+ sort.Strings(locationPrefixes)
+
+ for _, locationPrefix := range locationPrefixes {
+ internalTtl := ttls[locationPrefix]
ttl, _ := needle.ReadTTL(internalTtl)
days := int(ttl.Minutes() / 60 / 24)
if days == 0 {