Ensure the body is a string before comparing push rules. (#7701)

This commit is contained in:
Patrick Cloke 2020-06-15 16:20:34 -04:00 committed by GitHub
parent 2b2344652b
commit cc32fa7358
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 11 deletions

View file

@ -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.