diff --git a/cmd/data-scanner.go b/cmd/data-scanner.go index b9b8237d7..941a1541d 100644 --- a/cmd/data-scanner.go +++ b/cmd/data-scanner.go @@ -1186,10 +1186,10 @@ func applyExpiryOnNonTransitionedObjects(ctx context.Context, objLayer ObjectLay if lcEvent.Action.DeleteVersioned() { opts.VersionID = obj.VersionID } - if opts.VersionID == "" { - opts.Versioned = globalBucketVersioningSys.PrefixEnabled(obj.Bucket, obj.Name) - opts.VersionSuspended = globalBucketVersioningSys.PrefixSuspended(obj.Bucket, obj.Name) - } + + opts.Versioned = globalBucketVersioningSys.PrefixEnabled(obj.Bucket, obj.Name) + opts.VersionSuspended = globalBucketVersioningSys.PrefixSuspended(obj.Bucket, obj.Name) + if lcEvent.Action.DeleteAll() { opts.DeletePrefix = true }