From bede525dc9fd2fad74d9b610ce5ce42a58246ae1 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Sinha Date: Fri, 22 May 2020 22:08:58 +0530 Subject: [PATCH] bypass flag: Allow object retention removal (#9677) --- pkg/bucket/object/lock/lock.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/bucket/object/lock/lock.go b/pkg/bucket/object/lock/lock.go index 276cae9e7..3acc85a80 100644 --- a/pkg/bucket/object/lock/lock.go +++ b/pkg/bucket/object/lock/lock.go @@ -337,7 +337,7 @@ func ParseObjectRetention(reader io.Reader) (*ObjectRetention, error) { if err := xml.NewDecoder(io.LimitReader(reader, maxObjectRetentionSize)).Decode(&ret); err != nil { return nil, err } - if !ret.Mode.Valid() { + if ret.Mode != "" && !ret.Mode.Valid() { return &ret, ErrUnknownWORMModeDirective } @@ -347,7 +347,7 @@ func ParseObjectRetention(reader io.Reader) (*ObjectRetention, error) { return &ret, ErrPastObjectLockRetainDate } - if ret.RetainUntilDate.Before(t) { + if !ret.RetainUntilDate.IsZero() && ret.RetainUntilDate.Before(t) { return &ret, ErrPastObjectLockRetainDate }