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.
This commit is contained in:
Anis Elleuch 2021-02-17 23:51:29 +01:00 committed by GitHub
parent ffea6fcf09
commit e07918abe3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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() {