summary refs log tree commit diff
path: root/synapse/rest/room.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-12-10 14:02:48 +0000
committerErik Johnston <erik@matrix.org>2014-12-10 14:02:48 +0000
commit02db7eb209af879a0168a371b4cb1c2ad0fcab49 (patch)
tree27535103af5903aa66c4561c02cbc24f5a013fd7 /synapse/rest/room.py
parentMerge branch 'develop' of github.com:matrix-org/synapse into events_refactor (diff)
downloadsynapse-02db7eb209af879a0168a371b4cb1c2ad0fcab49.tar.xz
Fix bug when uploading state with empty state_key
Diffstat (limited to 'synapse/rest/room.py')
-rw-r--r--synapse/rest/room.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/synapse/rest/room.py b/synapse/rest/room.py
index 3d78b4ff5c..22e1244e57 100644
--- a/synapse/rest/room.py
+++ b/synapse/rest/room.py
@@ -147,16 +147,18 @@ class RoomStateEventRestServlet(RestServlet):
 
         content = _parse_json(request)
 
+        event_dict = {
+            "type": event_type,
+            "content": content,
+            "room_id": urllib.unquote(room_id),
+            "sender": user.to_string(),
+        }
+
+        if state_key is not None:
+            event_dict["state_key"] = urllib.unquote(state_key)
+
         msg_handler = self.handlers.message_handler
-        yield msg_handler.handle_event(
-            {
-                "type": event_type,
-                "content": content,
-                "room_id": room_id,
-                "sender": user.to_string(),
-                "state_key": urllib.unquote(state_key),
-            }
-        )
+        yield msg_handler.handle_event(event_dict)
 
         defer.returnValue((200, {}))