mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
fix: parse and save retainUntilDate in correct time format (#15741)
This commit is contained in:
parent
334f1ed45a
commit
50a8ba6a6f
@ -730,9 +730,12 @@ func putReplicationOpts(ctx context.Context, sc string, objInfo ObjectInfo) (put
|
|||||||
putOpts.Mode = rmode
|
putOpts.Mode = rmode
|
||||||
}
|
}
|
||||||
if retainDateStr, ok := lkMap.Lookup(xhttp.AmzObjectLockRetainUntilDate); ok {
|
if retainDateStr, ok := lkMap.Lookup(xhttp.AmzObjectLockRetainUntilDate); ok {
|
||||||
rdate, err := time.Parse(time.RFC3339, retainDateStr)
|
rdate, err := time.Parse(iso8601TimeFormat, retainDateStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return putOpts, err
|
rdate, err = time.Parse(time.RFC3339, retainDateStr)
|
||||||
|
if err != nil {
|
||||||
|
return putOpts, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
putOpts.RetainUntilDate = rdate
|
putOpts.RetainUntilDate = rdate
|
||||||
// set retention timestamp in opts
|
// set retention timestamp in opts
|
||||||
|
@ -2998,7 +2998,7 @@ func (api objectAPIHandlers) PutObjectRetentionHandler(w http.ResponseWriter, r
|
|||||||
}
|
}
|
||||||
if objRetention.Mode.Valid() {
|
if objRetention.Mode.Valid() {
|
||||||
oi.UserDefined[strings.ToLower(xhttp.AmzObjectLockMode)] = string(objRetention.Mode)
|
oi.UserDefined[strings.ToLower(xhttp.AmzObjectLockMode)] = string(objRetention.Mode)
|
||||||
oi.UserDefined[strings.ToLower(xhttp.AmzObjectLockRetainUntilDate)] = objRetention.RetainUntilDate.UTC().Format(time.RFC3339)
|
oi.UserDefined[strings.ToLower(xhttp.AmzObjectLockRetainUntilDate)] = objRetention.RetainUntilDate.UTC().Format(iso8601TimeFormat)
|
||||||
} else {
|
} else {
|
||||||
oi.UserDefined[strings.ToLower(xhttp.AmzObjectLockMode)] = ""
|
oi.UserDefined[strings.ToLower(xhttp.AmzObjectLockMode)] = ""
|
||||||
oi.UserDefined[strings.ToLower(xhttp.AmzObjectLockRetainUntilDate)] = ""
|
oi.UserDefined[strings.ToLower(xhttp.AmzObjectLockRetainUntilDate)] = ""
|
||||||
|
Loading…
Reference in New Issue
Block a user