fs: Fix expiry regression after versioning refactor (#10083)

Do not ignore non-versioned objects in lifecycle compute 
action function.
master
Anis Elleuch 4 years ago committed by GitHub
parent 68aaa5bbc3
commit 44c8af66ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      pkg/bucket/lifecycle/lifecycle.go

@ -210,9 +210,8 @@ func (lc Lifecycle) ComputeAction(obj ObjectOpts) Action {
}
}
// All other expiration only applies to latest versions
// (except if this is a delete marker)
if obj.IsLatest && !obj.DeleteMarker {
// Remove the object or simply add a delete marker (once) in a versioned bucket
if obj.VersionID == "" || obj.IsLatest && !obj.DeleteMarker {
switch {
case !rule.Expiration.IsDateNull():
if time.Now().UTC().After(rule.Expiration.Date.Time) {
@ -225,6 +224,7 @@ func (lc Lifecycle) ComputeAction(obj ObjectOpts) Action {
}
}
}
return action
}

Loading…
Cancel
Save