From: Or Friedmann Date: Thu, 23 Jul 2020 15:36:07 +0000 (+0300) Subject: rgw: fix expiration header returned even if there is only one tag in the object the... X-Git-Tag: v14.2.14~17^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=ac11ef9d00ea0ef40d16bd6d3dbcedf5955eeffb;p=ceph.git rgw: fix expiration header returned even if there is only one tag in the object the same as the rule Expiration header returned even if there is only one tag in the object the same as the rule Signed-off-by: Or Friedmann Reported-by: Avi Mor Fixes: https://tracker.ceph.com/issues/46614 (cherry picked from commit bf7c7e59f390afb53cb1e30a440ab26bb093c11c) Conflicts: src/rgw/rgw_lc.cc - whitespace (effectively no conflict) --- diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index 9d4097666f853..26200f6ce2259 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -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