From 5bb15c1590713a484e049a41a0fdd47232aeb139 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 12 Mar 2020 17:52:52 +0000 Subject: [PATCH] Try to determine room version for SendJoin --- federationapi/routing/join.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/federationapi/routing/join.go b/federationapi/routing/join.go index ca50e25f4..6ab2a164e 100644 --- a/federationapi/routing/join.go +++ b/federationapi/routing/join.go @@ -116,7 +116,16 @@ func SendJoin( keys gomatrixserverlib.KeyRing, roomID, eventID string, ) util.JSONResponse { - event, err := gomatrixserverlib.NewEventFromUntrustedJSON(request.Content()) + vReq := api.QueryRoomVersionForRoomIDRequest{RoomID: roomID} + vRes := api.QueryRoomVersionForRoomIDResponse{} + if query.QueryRoomVersionForRoomID(httpReq.Context(), &vReq, &vRes) != nil { + return util.JSONResponse{ + Code: http.StatusBadRequest, + JSON: jsonerror.NotJSON("Couldn't determine the room version for this room."), + } + } + + event, err := gomatrixserverlib.NewEventFromUntrustedJSON(request.Content(), vRes.RoomVersion) if err != nil { return util.JSONResponse{ Code: http.StatusBadRequest,