From c93f381028a09f53d651f39dadbf8aaed8b3b03a Mon Sep 17 00:00:00 2001 From: Or Friedmann Date: Thu, 10 Oct 2019 16:35:59 +0300 Subject: [PATCH] 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 --- src/rgw/rgw_lc.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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); } } } -- 2.47.3