lifecycle: Fix object expiration date (#9791)

re-use PredictExpiryTime() in ComputeAction()
This commit is contained in:
Anis Elleuch
2020-06-09 17:40:53 +01:00
committed by GitHub
parent 920b863955
commit 790323ac37
2 changed files with 7 additions and 17 deletions

View File

@@ -257,7 +257,7 @@ func isETagEqual(left, right string) bool {
// after analyzing the current bucket lifecycle rules if any.
func setAmzExpirationHeader(w http.ResponseWriter, bucket string, objInfo ObjectInfo) {
if lc, err := globalLifecycleSys.Get(bucket); err == nil {
ruleID, expiryTime := lc.PredictExpiryTime(objInfo.Name, objInfo.UserTags)
ruleID, expiryTime := lc.PredictExpiryTime(objInfo.Name, objInfo.ModTime, objInfo.UserTags)
if !expiryTime.IsZero() {
w.Header()[xhttp.AmzExpiration] = []string{
fmt.Sprintf(`expiry-date="%s", rule-id="%s"`, expiryTime.Format(http.TimeFormat), ruleID),