From b6b26dba87e4a4d4b89fc4778b97e5d2fd16a0a5 Mon Sep 17 00:00:00 2001 From: Poorna Date: Thu, 6 Oct 2022 13:53:56 -0700 Subject: [PATCH] fix: GetObjectRetention to parse in ISO8601 time format (#15809) --- internal/bucket/object/lock/lock.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/bucket/object/lock/lock.go b/internal/bucket/object/lock/lock.go index 4c007851e..e8546f1eb 100644 --- a/internal/bucket/object/lock/lock.go +++ b/internal/bucket/object/lock/lock.go @@ -45,6 +45,10 @@ const ( // RetCompliance - compliance mode. RetCompliance RetMode = "COMPLIANCE" + + // RFC3339 a subset of the ISO8601 timestamp format. e.g 2014-04-29T18:30:38Z + iso8601TimeFormat = "2006-01-02T15:04:05.000Z" // Reply date format with millisecond precision. + ) // Valid - returns if retention mode is valid @@ -452,7 +456,7 @@ func GetObjectRetentionMeta(meta map[string]string) ObjectRetention { tillStr, ok = meta[AmzObjectLockRetainUntilDate] } if ok { - if t, e := time.Parse(time.RFC3339, tillStr); e == nil { + if t, e := time.Parse(iso8601TimeFormat, tillStr); e == nil { retainTill = RetentionDate{t.UTC()} } }