diff options
| author | chrislu <chris.lu@gmail.com> | 2025-06-16 11:48:25 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2025-06-16 11:48:29 -0700 |
| commit | 78069605a61515e95adf6b56ff07195ada7197bc (patch) | |
| tree | 82966b1edcbe06e6dc04cec1bf1354fcfcb7eba2 | |
| parent | 549fb110d7c6372dc6a1e171cde5898f14212963 (diff) | |
| download | seaweedfs-78069605a61515e95adf6b56ff07195ada7197bc.tar.xz seaweedfs-78069605a61515e95adf6b56ff07195ada7197bc.zip | |
sort lifecycles
| -rw-r--r-- | weed/s3api/s3api_bucket_handlers.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/weed/s3api/s3api_bucket_handlers.go b/weed/s3api/s3api_bucket_handlers.go index 2f535d0d0..52470e7df 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 { |
