From 25dd43ab75e431d0b2b4bb62fd54a0bfc4dc78be Mon Sep 17 00:00:00 2001 From: zhang Shaowen Date: Thu, 26 Sep 2019 15:40:18 +0800 Subject: [PATCH] rgw: filter prefix should be used when generating expiration header. The rule prefix is set with old version lifecycle configure. While filter prefix is the latest version which AWS suggests users use. Fixes: https://tracker.ceph.com/issues/45144 Signed-off-by: zhang Shaowen --- src/rgw/rgw_lc.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index 18cb5aa84ba..b813bfcd80d 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -1580,8 +1580,8 @@ std::string s3_expiration_header( for (const auto& ri : rule_map) { const auto& rule = ri.second; auto& id = rule.get_id(); - auto& prefix = rule.get_prefix(); auto& filter = rule.get_filter(); + auto& prefix = filter.has_prefix() ? filter.get_prefix(): rule.get_prefix(); auto& expiration = rule.get_expiration(); auto& noncur_expiration = rule.get_noncur_expiration(); @@ -1611,7 +1611,7 @@ std::string s3_expiration_header( if(! prefix.empty()) { if (! boost::starts_with(obj_key.name, prefix)) - continue; + continue; } if (filter.has_tags()) {