diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2022-02-28 17:40:24 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-28 17:40:24 +0000 |
commit | 6c0b44a3d73f73dc5913f081418347645dc84d6f (patch) | |
tree | c5f902578af302b30d2be221fea51c49731f5b32 /synapse/api | |
parent | Actually fix bad debug logging rejecting device list & signing key transactio... (diff) | |
download | synapse-6c0b44a3d73f73dc5913f081418347645dc84d6f.tar.xz |
Fix `PushRuleEvaluator` and `Filter` to work on frozendicts (#12100)
* Fix `PushRuleEvaluator` to work on frozendicts frozendicts do not (necessarily) inherit from dict, so this needs to handle them correctly. * Fix event filtering for frozen events Looks like this one was introduced by #11194.
Diffstat (limited to 'synapse/api')
-rw-r--r-- | synapse/api/filtering.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/synapse/api/filtering.py b/synapse/api/filtering.py index fe4cc2e8ee..cb532d7238 100644 --- a/synapse/api/filtering.py +++ b/synapse/api/filtering.py @@ -22,6 +22,7 @@ from typing import ( Dict, Iterable, List, + Mapping, Optional, Set, TypeVar, @@ -361,10 +362,10 @@ class Filter: return self._check_fields(field_matchers) else: content = event.get("content") - # Content is assumed to be a dict below, so ensure it is. This should + # Content is assumed to be a mapping below, so ensure it is. This should # always be true for events, but account_data has been allowed to # have non-dict content. - if not isinstance(content, dict): + if not isinstance(content, Mapping): content = {} sender = event.get("sender", None) |