From aaaf2fb53f6fc92805101edbe3a8bf56b50e2d40 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Thu, 7 May 2026 22:28:20 -0700 Subject: [PATCH] refactor(s3api): drop redundant prefix normalization on read path encodeBucketLifecycleTTLRules already normalizes rule.Prefix before it hits the filer; matchBucketLifecycleTTLSeconds is on the per-object hot path and shouldn't re-normalize. --- weed/s3api/s3api_bucket_lifecycle_ttl.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/weed/s3api/s3api_bucket_lifecycle_ttl.go b/weed/s3api/s3api_bucket_lifecycle_ttl.go index 80eff08b8..7da465f37 100644 --- a/weed/s3api/s3api_bucket_lifecycle_ttl.go +++ b/weed/s3api/s3api_bucket_lifecycle_ttl.go @@ -72,7 +72,8 @@ func matchBucketLifecycleTTLSeconds(rules []bucketLifecycleTTLRule, objectKey st var bestPrefix string var ttlSeconds int32 for _, rule := range rules { - prefix := normalizeLifecycleRulePrefix(rule.Prefix) + // rule.Prefix is already normalized at encode time. + prefix := rule.Prefix if prefix != "" && !strings.HasPrefix(objectKey, prefix) { continue }