mirror of
https://github.com/minio/minio.git
synced 2025-01-25 21:53:16 -05:00
Set LastModified time from source for bucket replication (#10627)
This commit is contained in:
parent
c6a9a94f94
commit
045e30f2c1
@ -159,9 +159,10 @@ func putOpts(ctx context.Context, r *http.Request, bucket, object string, metada
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mtime := strings.TrimSpace(r.Header.Get(xhttp.MinIOSourceMTime))
|
mtimeStr := strings.TrimSpace(r.Header.Get(xhttp.MinIOSourceMTime))
|
||||||
if mtime != "" {
|
var mtime time.Time
|
||||||
opts.MTime, err = time.Parse(time.RFC3339, mtime)
|
if mtimeStr != "" {
|
||||||
|
mtime, err = time.Parse(time.RFC3339, mtimeStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return opts, InvalidArgument{
|
return opts, InvalidArgument{
|
||||||
Bucket: bucket,
|
Bucket: bucket,
|
||||||
@ -170,7 +171,7 @@ func putOpts(ctx context.Context, r *http.Request, bucket, object string, metada
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
opts.MTime = UTCNow()
|
mtime = UTCNow()
|
||||||
}
|
}
|
||||||
etag := strings.TrimSpace(r.Header.Get(xhttp.MinIOSourceETag))
|
etag := strings.TrimSpace(r.Header.Get(xhttp.MinIOSourceETag))
|
||||||
if etag != "" {
|
if etag != "" {
|
||||||
@ -187,6 +188,7 @@ func putOpts(ctx context.Context, r *http.Request, bucket, object string, metada
|
|||||||
UserDefined: metadata,
|
UserDefined: metadata,
|
||||||
VersionID: vid,
|
VersionID: vid,
|
||||||
Versioned: versioned,
|
Versioned: versioned,
|
||||||
|
MTime: mtime,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
if GlobalGatewaySSE.SSEC() && crypto.SSEC.IsRequested(r.Header) {
|
if GlobalGatewaySSE.SSEC() && crypto.SSEC.IsRequested(r.Header) {
|
||||||
@ -210,6 +212,7 @@ func putOpts(ctx context.Context, r *http.Request, bucket, object string, metada
|
|||||||
UserDefined: metadata,
|
UserDefined: metadata,
|
||||||
VersionID: vid,
|
VersionID: vid,
|
||||||
Versioned: versioned,
|
Versioned: versioned,
|
||||||
|
MTime: mtime,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
// default case of passing encryption headers and UserDefined metadata to backend
|
// default case of passing encryption headers and UserDefined metadata to backend
|
||||||
@ -219,6 +222,7 @@ func putOpts(ctx context.Context, r *http.Request, bucket, object string, metada
|
|||||||
}
|
}
|
||||||
opts.VersionID = vid
|
opts.VersionID = vid
|
||||||
opts.Versioned = versioned
|
opts.Versioned = versioned
|
||||||
|
opts.MTime = mtime
|
||||||
return opts, nil
|
return opts, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user