mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 00:34:47 -04:00
Ensure the body is a string before comparing push rules. (#7701)
This commit is contained in:
parent
2b2344652b
commit
cc32fa7358
3 changed files with 33 additions and 11 deletions
|
@ -131,7 +131,7 @@ class PushRuleEvaluatorForEvent(object):
|
|||
# XXX: optimisation: cache our pattern regexps
|
||||
if condition["key"] == "content.body":
|
||||
body = self._event.content.get("body", None)
|
||||
if not body:
|
||||
if not body or not isinstance(body, str):
|
||||
return False
|
||||
|
||||
return _glob_matches(pattern, body, word_boundary=True)
|
||||
|
@ -147,7 +147,7 @@ class PushRuleEvaluatorForEvent(object):
|
|||
return False
|
||||
|
||||
body = self._event.content.get("body", None)
|
||||
if not body:
|
||||
if not body or not isinstance(body, str):
|
||||
return False
|
||||
|
||||
# Similar to _glob_matches, but do not treat display_name as a glob.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue