From e07918abe3cf75eb6d286392c694a7cb67f7de99 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Wed, 17 Feb 2021 23:51:29 +0100 Subject: [PATCH] lifecycle: Fix expiration header in some cases (#11565) Expiration header was not correctly computed in case of non current versions. The behavior is fixed in this commit. --- pkg/bucket/lifecycle/lifecycle.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/bucket/lifecycle/lifecycle.go b/pkg/bucket/lifecycle/lifecycle.go index 9495ea739..2b7a0547d 100644 --- a/pkg/bucket/lifecycle/lifecycle.go +++ b/pkg/bucket/lifecycle/lifecycle.go @@ -331,7 +331,7 @@ func (lc Lifecycle) PredictExpiryTime(obj ObjectOpts) (string, time.Time) { // expiration date and its associated rule ID. for _, rule := range lc.FilterActionableRules(obj) { if !rule.NoncurrentVersionExpiration.IsDaysNull() && !obj.IsLatest && obj.VersionID != "" { - return rule.ID, ExpectedExpiryTime(time.Now(), int(rule.NoncurrentVersionExpiration.NoncurrentDays)) + return rule.ID, ExpectedExpiryTime(obj.SuccessorModTime, int(rule.NoncurrentVersionExpiration.NoncurrentDays)) } if !rule.Expiration.IsDateNull() {