fix: time.Parse RFC3339Nano (#16892)

This commit is contained in:
jiuker 2023-03-28 02:51:54 +08:00 committed by GitHub
parent 66ff17e452
commit 16feef2a2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -232,7 +232,7 @@ func putOpts(ctx context.Context, r *http.Request, bucket, object string, metada
mtimeStr := strings.TrimSpace(r.Header.Get(xhttp.MinIOSourceMTime)) mtimeStr := strings.TrimSpace(r.Header.Get(xhttp.MinIOSourceMTime))
mtime := UTCNow() mtime := UTCNow()
if mtimeStr != "" { if mtimeStr != "" {
mtime, err = time.Parse(time.RFC3339, mtimeStr) mtime, err = time.Parse(time.RFC3339Nano, mtimeStr)
if err != nil { if err != nil {
return opts, InvalidArgument{ return opts, InvalidArgument{
Bucket: bucket, Bucket: bucket,
@ -353,7 +353,7 @@ func completeMultipartOpts(ctx context.Context, r *http.Request, bucket, object
mtimeStr := strings.TrimSpace(r.Header.Get(xhttp.MinIOSourceMTime)) mtimeStr := strings.TrimSpace(r.Header.Get(xhttp.MinIOSourceMTime))
mtime := UTCNow() mtime := UTCNow()
if mtimeStr != "" { if mtimeStr != "" {
mtime, err = time.Parse(time.RFC3339, mtimeStr) mtime, err = time.Parse(time.RFC3339Nano, mtimeStr)
if err != nil { if err != nil {
return opts, InvalidArgument{ return opts, InvalidArgument{
Bucket: bucket, Bucket: bucket,