From 1b52775ccdfb6e25ee433b610d634d4ee7bb2709 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 9 Mar 2020 09:10:01 +0000 Subject: [PATCH] If room_version isn't specified in the m.room.create event, assume room version 1 --- roomserver/storage/postgres/storage.go | 4 +++- roomserver/storage/sqlite3/storage.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/roomserver/storage/postgres/storage.go b/roomserver/storage/postgres/storage.go index 4499388a0..6f8fd9f66 100644 --- a/roomserver/storage/postgres/storage.go +++ b/roomserver/storage/postgres/storage.go @@ -72,7 +72,9 @@ func (d *Database) StoreEvent( } } - roomVersion := strconv.Itoa(int(version.GetDefaultRoomVersion())) + // The only room version where the "room_version" key isn't specified is + // room version 1 + roomVersion := 1 // The below works because the first event to be persisted to the database // is always the m.room.create event. We can therefore set the room version // correctly at the same time as assigning the room NID. diff --git a/roomserver/storage/sqlite3/storage.go b/roomserver/storage/sqlite3/storage.go index b3f375887..e70a1b9ec 100644 --- a/roomserver/storage/sqlite3/storage.go +++ b/roomserver/storage/sqlite3/storage.go @@ -93,7 +93,9 @@ func (d *Database) StoreEvent( } } - roomVersion := strconv.Itoa(int(version.GetDefaultRoomVersion())) + // The only room version where the "room_version" key isn't specified is + // room version 1 + roomVersion := 1 // The below works because the first event to be persisted to the database // is always the m.room.create event. We can therefore set the room version // correctly at the same time as assigning the room NID.