mirror of
https://github.com/minio/minio.git
synced 2025-04-17 17:30:07 -04:00
lc: Return expiration header only when version id is unspecified (#11718)
Follow S3 specification to return Expiration header in HEAD/GET call only when version-id is not passed in the request.
This commit is contained in:
parent
691035832a
commit
0d124095ea
@ -179,22 +179,25 @@ func setObjectHeaders(w http.ResponseWriter, objInfo ObjectInfo, rs *HTTPRangeSp
|
|||||||
if objInfo.VersionID != "" {
|
if objInfo.VersionID != "" {
|
||||||
w.Header()[xhttp.AmzVersionID] = []string{objInfo.VersionID}
|
w.Header()[xhttp.AmzVersionID] = []string{objInfo.VersionID}
|
||||||
}
|
}
|
||||||
|
|
||||||
if objInfo.ReplicationStatus.String() != "" {
|
if objInfo.ReplicationStatus.String() != "" {
|
||||||
w.Header()[xhttp.AmzBucketReplicationStatus] = []string{objInfo.ReplicationStatus.String()}
|
w.Header()[xhttp.AmzBucketReplicationStatus] = []string{objInfo.ReplicationStatus.String()}
|
||||||
}
|
}
|
||||||
|
|
||||||
if lc, err := globalLifecycleSys.Get(objInfo.Bucket); err == nil {
|
if lc, err := globalLifecycleSys.Get(objInfo.Bucket); err == nil {
|
||||||
ruleID, expiryTime := lc.PredictExpiryTime(lifecycle.ObjectOpts{
|
if opts.VersionID == "" {
|
||||||
Name: objInfo.Name,
|
if ruleID, expiryTime := lc.PredictExpiryTime(lifecycle.ObjectOpts{
|
||||||
UserTags: objInfo.UserTags,
|
Name: objInfo.Name,
|
||||||
VersionID: objInfo.VersionID,
|
UserTags: objInfo.UserTags,
|
||||||
ModTime: objInfo.ModTime,
|
VersionID: objInfo.VersionID,
|
||||||
IsLatest: objInfo.IsLatest,
|
ModTime: objInfo.ModTime,
|
||||||
DeleteMarker: objInfo.DeleteMarker,
|
IsLatest: objInfo.IsLatest,
|
||||||
SuccessorModTime: objInfo.SuccessorModTime,
|
DeleteMarker: objInfo.DeleteMarker,
|
||||||
})
|
SuccessorModTime: objInfo.SuccessorModTime,
|
||||||
if !expiryTime.IsZero() {
|
}); !expiryTime.IsZero() {
|
||||||
w.Header()[xhttp.AmzExpiration] = []string{
|
w.Header()[xhttp.AmzExpiration] = []string{
|
||||||
fmt.Sprintf(`expiry-date="%s", rule-id="%s"`, expiryTime.Format(http.TimeFormat), ruleID),
|
fmt.Sprintf(`expiry-date="%s", rule-id="%s"`, expiryTime.Format(http.TimeFormat), ruleID),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if objInfo.TransitionStatus == lifecycle.TransitionComplete {
|
if objInfo.TransitionStatus == lifecycle.TransitionComplete {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user