summary refs log tree commit diff
path: root/synapse/handlers/message.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2019-01-25 15:59:36 +0000
committerGitHub <noreply@github.com>2019-01-25 15:59:36 +0000
commitb6dce9b9fde07d450e22da479108b2859d3bd49d (patch)
tree13f3757fc0ad20bbf297830918b616da41ca3f1f /synapse/handlers/message.py
parentMerge pull request #4471 from matrix-org/erikj/sqlite_native_upsert (diff)
parentNewsfile (diff)
downloadsynapse-b6dce9b9fde07d450e22da479108b2859d3bd49d.tar.xz
Merge pull request #4470 from matrix-org/erikj/require_format_version
Require event format version to parse or create events
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r--synapse/handlers/message.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index a7cd779b02..7aaa4fba33 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -278,7 +278,15 @@ class EventCreationHandler(object):
         """
         yield self.auth.check_auth_blocking(requester.user.to_string())
 
-        builder = self.event_builder_factory.new(event_dict)
+        if event_dict["type"] == EventTypes.Create and event_dict["state_key"] == "":
+            room_version = event_dict["content"]["room_version"]
+        else:
+            try:
+                room_version = yield self.store.get_room_version(event_dict["room_id"])
+            except NotFoundError:
+                raise AuthError(403, "Unknown room")
+
+        builder = self.event_builder_factory.new(room_version, event_dict)
 
         self.validator.validate_new(builder)