]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix expiration header returned even if there is only one tag in the object the... 37806/head
authorOr Friedmann <ofriedma@redhat.com>
Thu, 23 Jul 2020 15:36:07 +0000 (18:36 +0300)
committerNathan Cutler <ncutler@suse.com>
Mon, 26 Oct 2020 18:47:39 +0000 (19:47 +0100)
Expiration header returned even if there is only one tag in the object the same as the rule

Signed-off-by: Or Friedmann <ofriedma@redhat.com>
Reported-by: Avi Mor <avmor@redhat.com>
Fixes: https://tracker.ceph.com/issues/46614
(cherry picked from commit bf7c7e59f390afb53cb1e30a440ab26bb093c11c)

Conflicts:
src/rgw/rgw_lc.cc
- whitespace (effectively no conflict)

src/rgw/rgw_lc.cc

index 9d4097666f8533888b07e0261b5bebfec0528a50..26200f6ce2259e3b255a6f99a881724cb75c273d 100644 (file)
@@ -1611,21 +1611,19 @@ std::string s3_expiration_header(
       const RGWObjTags& rule_tagset = filter.get_tags();
       for (auto& tag : rule_tagset.get_tags()) {
        /* remember, S3 tags are {key,value} tuples */
-       auto ma1 = obj_tag_map.find(tag.first);
-       if (ma1 != obj_tag_map.end()) {
-         if (tag.second == ma1->second) {
-           ldpp_dout(dpp, 10) << "tag match obj_key=" << obj_key
-                              << " rule_id=" << id
-                              << " tag=" << tag
-                              << " (ma=" << *ma1 << ")"
-                              << dendl;
-           tag_match = true;
-           break;
-         }
-       }
+        tag_match = true;
+        auto obj_tag = obj_tag_map.find(tag.first);
+        if (obj_tag == obj_tag_map.end() || obj_tag->second != tag.second) {
+               ldpp_dout(dpp, 10) << "tag does not match obj_key=" << obj_key
+                                << " rule_id=" << id
+                                << " tag=" << tag
+                                << dendl;
+               tag_match = false;
+               break;
+             }
       }
       if (! tag_match)
-       continue;
+             continue;
     }
 
     // compute a uniform expiration date