From 44c8af66ad1dae2bdcd27771209cc83c3fce5065 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Sat, 18 Jul 2020 23:43:13 +0100 Subject: [PATCH] fs: Fix expiry regression after versioning refactor (#10083) Do not ignore non-versioned objects in lifecycle compute action function. --- pkg/bucket/lifecycle/lifecycle.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/bucket/lifecycle/lifecycle.go b/pkg/bucket/lifecycle/lifecycle.go index ad74339b8..d0eaa679b 100644 --- a/pkg/bucket/lifecycle/lifecycle.go +++ b/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 }