fix: GetObjectRetention to parse in ISO8601 time format (#15809)

This commit is contained in:
Poorna 2022-10-06 13:53:56 -07:00 committed by GitHub
parent 5c034e26bd
commit b6b26dba87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,6 +45,10 @@ const (
// RetCompliance - compliance mode. // RetCompliance - compliance mode.
RetCompliance RetMode = "COMPLIANCE" 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 // Valid - returns if retention mode is valid
@ -452,7 +456,7 @@ func GetObjectRetentionMeta(meta map[string]string) ObjectRetention {
tillStr, ok = meta[AmzObjectLockRetainUntilDate] tillStr, ok = meta[AmzObjectLockRetainUntilDate]
} }
if ok { 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()} retainTill = RetentionDate{t.UTC()}
} }
} }