summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorPatrik Oldsberg <patrik.oldsberg@ericsson.com>2016-02-17 10:53:06 +0100
committerPatrik Oldsberg <patrik.oldsberg@ericsson.com>2016-02-17 12:59:41 +0100
commit536f949a1a0e531314e023436c22859b5114376d (patch)
tree3d8285c58a2094bf0dc1ed46ae185bd5afd5ce87 /synapse
parentFix typo in request validation for adding push rules. (diff)
downloadsynapse-536f949a1a0e531314e023436c22859b5114376d.tar.xz
api/filtering: don't assume that event content will always be a dict
Signed-off-by: Patrik Oldsberg <patrik.oldsberg@ericsson.com>
Diffstat (limited to 'synapse')
-rw-r--r--synapse/api/filtering.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/synapse/api/filtering.py b/synapse/api/filtering.py
index 6eff83e5f8..cd699ef27f 100644
--- a/synapse/api/filtering.py
+++ b/synapse/api/filtering.py
@@ -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),