0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-11-16 15:01:23 +01:00

api/filtering: don't assume that event content will always be a dict

Signed-off-by: Patrik Oldsberg <patrik.oldsberg@ericsson.com>
This commit is contained in:
Patrik Oldsberg 2016-02-17 10:53:06 +01:00
parent 458782bf67
commit 536f949a1a

View file

@ -198,7 +198,10 @@ class Filter(object):
sender = event.get("sender", None)
if not sender:
# Presence events have their 'sender' in content.user_id
sender = event.get("content", {}).get("user_id", None)
content = event.get("content")
# account_data has been allowed to have non-dict content, so check type first
if isinstance(content, dict):
sender = content.get("user_id")
return self.check_fields(
event.get("room_id", None),