From bf7c7e59f390afb53cb1e30a440ab26bb093c11c Mon Sep 17 00:00:00 2001 From: Or Friedmann Date: Thu, 23 Jul 2020 18:36:07 +0300 Subject: [PATCH] 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 --- src/rgw/rgw_lc.cc | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index 61394ccd2992..3ae1149f8f94 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 -- 2.47.3