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.
master
Anis Elleuch 4 years ago committed by GitHub
parent ffea6fcf09
commit e07918abe3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      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. // expiration date and its associated rule ID.
for _, rule := range lc.FilterActionableRules(obj) { for _, rule := range lc.FilterActionableRules(obj) {
if !rule.NoncurrentVersionExpiration.IsDaysNull() && !obj.IsLatest && obj.VersionID != "" { 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() { if !rule.Expiration.IsDateNull() {

Loading…
Cancel
Save