summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-01-18 17:04:36 +0000
committerErik Johnston <erik@matrix.org>2016-01-18 17:04:36 +0000
commit47f82e4408763d834a0097dceb8b2cca4b0ba4d5 (patch)
tree85688fde82986dc8c3b7f4b84a6e0757ecc385ff
parentRemove dead code (diff)
downloadsynapse-47f82e4408763d834a0097dceb8b2cca4b0ba4d5.tar.xz
Fix branch didn't check word_boundary
-rw-r--r--synapse/push/push_rule_evaluator.py12
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,)