summary refs log tree commit diff
diff options
context:
space:
mode:
-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,)