diff options
author | Kegan Dougal <kegan@matrix.org> | 2021-01-15 18:49:21 +0000 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2021-01-15 18:49:21 +0000 |
commit | fdd534f86a493c26f6935cf31e721b1a2605de8c (patch) | |
tree | d89453480d81ecb2be740cd9fcf0e859c43a727d /setup | |
parent | 2113da53326cec2f3f9c1d7a641e6768ecddbfbf (diff) |
Escape the create event content key so it can be extracted correctly
Diffstat (limited to 'setup')
-rw-r--r-- | setup/mscs/msc2946/msc2946.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/setup/mscs/msc2946/msc2946.go b/setup/mscs/msc2946/msc2946.go index 3405ebe7..2b547737 100644 --- a/setup/mscs/msc2946/msc2946.go +++ b/setup/mscs/msc2946/msc2946.go @@ -19,6 +19,7 @@ import ( "context" "fmt" "net/http" + "strings" "sync" "github.com/gorilla/mux" @@ -198,7 +199,8 @@ func (w *walker) walk() *SpacesResponse { roomType := "" create := w.stateEvent(roomID, gomatrixserverlib.MRoomCreate, "") if create != nil { - roomType = gjson.GetBytes(create.Content(), ConstCreateEventContentKey).Str + // escape the `.`s so gjson doesn't think it's nested + roomType = gjson.GetBytes(create.Content(), strings.ReplaceAll(ConstCreateEventContentKey, ".", `\.`)).Str } // Add the total number of events to `PublicRoomsChunk` under `num_refs`. Add `PublicRoomsChunk` to `rooms`. |