A rule containing a tag filter but no constraining prefix is
legal, as is a sequence of >1 such rules.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
if (rule->get_filter().has_tags()){
op.obj_tags = rule->get_filter().get_tags();
}
- auto ret = prefix_map.emplace(std::move(prefix), std::move(op));
- return ret.second;
+
+ /* prefix is optional, update prefix map only if prefix...exists */
+ if (!prefix.empty()) {
+ auto ret = prefix_map.emplace(std::move(prefix), std::move(op));
+ return ret.second;
+ }
+
+ return true;
}
int RGWLifecycleConfiguration::check_and_add_rule(LCRule *rule)