]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: filter prefix should be used when generating expiration header. The rule prefix... 30584/head
authorzhang Shaowen <zhangshaowen@cmss.chinamobile.com>
Thu, 26 Sep 2019 07:40:18 +0000 (15:40 +0800)
committerzhangshaowen <zhangshaowen_yewu@cmss.chinamobile.com>
Thu, 23 Jul 2020 01:16:53 +0000 (09:16 +0800)
While filter prefix is the latest version which AWS suggests users use.

Fixes: https://tracker.ceph.com/issues/45144
Signed-off-by: zhang Shaowen <zhangshaowen_yewu@cmss.chinamobile.com>
src/rgw/rgw_lc.cc

index 18cb5aa84ba8a9f279e72214e02cc48e1d1444f6..b813bfcd80d5129f4cc66765586818b3c995064e 100644 (file)
@@ -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()) {