From: Or Friedmann Date: Thu, 10 Oct 2019 13:35:59 +0000 (+0300) Subject: Fix s3 lifecycle expiration header does not return the earliest rule that will be... X-Git-Tag: v15.1.0~847^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F29399%2Fhead;p=ceph.git Fix s3 lifecycle expiration header does not return the earliest rule that will be applied Fixes: https://tracker.ceph.com/issues/41010 Signed-off-by: Or Friedmann --- diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index 1aa67adb965a..7b04526ca0e7 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -1626,22 +1626,21 @@ std::string s3_expiration_header( rule_expiration_date = boost::optional( ceph::from_iso_8601(rule.get_expiration().get_date())); - rule_id = boost::optional(id); } else { if (rule_expiration.has_days()) { rule_expiration_date = boost::optional( mtime + make_timespan(rule_expiration.get_days()*24*60*60)); - rule_id = boost::optional(id); } } // update earliest expiration if (rule_expiration_date) { if ((! expiration_date) || - (*expiration_date < *rule_expiration_date)) { + (*expiration_date > *rule_expiration_date)) { expiration_date = boost::optional(rule_expiration_date); + rule_id = boost::optional(id); } } }