mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-29 01:33:10 -06:00
fix:Inviting to an unsupported room version return M_BAD_JSON instead of M_UNSUPPORTED_ROOM_VERSION
Signed-off-by: Meenal Trivedi <meenaltrivedi6102@gmail.com>
This commit is contained in:
parent
b954343d73
commit
3324fbd820
|
|
@ -37,8 +37,18 @@ func InviteV2(
|
||||||
cfg *config.FederationAPI,
|
cfg *config.FederationAPI,
|
||||||
rsAPI api.RoomserverInternalAPI,
|
rsAPI api.RoomserverInternalAPI,
|
||||||
keys gomatrixserverlib.JSONVerifier,
|
keys gomatrixserverlib.JSONVerifier,
|
||||||
) util.JSONResponse {
|
) util.JSONResponse {git
|
||||||
|
|
||||||
inviteReq := gomatrixserverlib.InviteV2Request{}
|
inviteReq := gomatrixserverlib.InviteV2Request{}
|
||||||
|
// Check to see if the room_version is supported
|
||||||
|
if _, err := roomserverVersion.SupportedRoomVersion(inviteReq.RoomVersion()); err != nil {
|
||||||
|
return util.JSONResponse{
|
||||||
|
Code: http.StatusBadRequest,
|
||||||
|
JSON: jsonerror.UnsupportedRoomVersion(
|
||||||
|
fmt.Sprintf("Room version %q is not supported by this server.", inviteReq.RoomVersion()),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
err := json.Unmarshal(request.Content(), &inviteReq)
|
err := json.Unmarshal(request.Content(), &inviteReq)
|
||||||
switch err.(type) {
|
switch err.(type) {
|
||||||
case gomatrixserverlib.BadJSONError:
|
case gomatrixserverlib.BadJSONError:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue