diff options
author | Erik Johnston <erik@matrix.org> | 2016-01-18 17:04:36 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-01-18 17:04:36 +0000 |
commit | 47f82e4408763d834a0097dceb8b2cca4b0ba4d5 (patch) | |
tree | 85688fde82986dc8c3b7f4b84a6e0757ecc385ff | |
parent | Remove dead code (diff) | |
download | synapse-47f82e4408763d834a0097dceb8b2cca4b0ba4d5.tar.xz |
Fix branch didn't check word_boundary
-rw-r--r-- | synapse/push/push_rule_evaluator.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/synapse/push/push_rule_evaluator.py b/synapse/push/push_rule_evaluator.py index 78d4b564d4..86d8ac5c4f 100644 --- a/synapse/push/push_rule_evaluator.py +++ b/synapse/push/push_rule_evaluator.py @@ -273,10 +273,16 @@ def _glob_matches(glob, value, word_boundary=False): ), r, ) - r = r + "$" - r = re.compile(r, flags=re.IGNORECASE) + if word_boundary: + r = "\b%s\b" % (r,) + r = re.compile(r, flags=re.IGNORECASE) + + return r.search(value) + else: + r = r + "$" + r = re.compile(r, flags=re.IGNORECASE) - return r.match(value) + return r.match(value) elif word_boundary: r = re.escape(glob) r = "\b%s\b" % (r,) |