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: v16.1.0~793^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bf7c7e59f390afb53cb1e30a440ab26bb093c11c;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 --- diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index 61394ccd299..3ae1149f8f9 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -2194,21 +2194,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