Skip to content
Snippets Groups Projects
Commit 4ffac34a authored by David Baker's avatar David Baker
Browse files

Add glob asterisks when running rules.

Means that now you can't do exact matches even in override rules,
but I think we can live with that. Advantage is that you'll now
always get back what was put in to the API.
parent 9bfc8bf7
No related branches found
No related tags found
No related merge requests found
......@@ -137,6 +137,11 @@ class Pusher(object):
return False
pat = condition['pattern']
if pat.strip("*?[]") == pat:
# no special glob characters so we assume the user means
# 'contains this string' rather than 'is this string'
pat = "*%s*" % (pat,)
val = _value_for_dotted_key(condition['key'], ev)
if val is None:
return False
......
......@@ -98,10 +98,7 @@ class PushRuleRestServlet(ClientV1RestServlet):
if 'pattern' not in req_obj:
raise InvalidRuleException("Content rule missing 'pattern'")
pat = req_obj['pattern']
if pat.strip("*?[]") == pat:
# no special glob characters so we assume the user means
# 'contains this string' rather than 'is this string'
pat = "*%s*" % (pat,)
conditions = [{
'kind': 'event_match',
'key': 'content.body',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment