diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-08-25 09:51:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-25 09:51:36 +0100 |
commit | 16156b0b0988e7b1746b2834e6357c3c90bc8465 (patch) | |
tree | b2813ef5396092d2c30161a692f757531d6e7a1a /federationapi | |
parent | 522bd2999f605258e95565c6d648d2f7ea001ea4 (diff) |
Fix 500s on `/state`, `/state_ids` when state not known (#2672)
This was due to bad error bubbling.
Diffstat (limited to 'federationapi')
-rw-r--r-- | federationapi/routing/join.go | 6 | ||||
-rw-r--r-- | federationapi/routing/state.go | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/federationapi/routing/join.go b/federationapi/routing/join.go index b48eaf78..1a121987 100644 --- a/federationapi/routing/join.go +++ b/federationapi/routing/join.go @@ -329,6 +329,12 @@ func SendJoin( JSON: jsonerror.NotFound("Room does not exist"), } } + if !stateAndAuthChainResponse.StateKnown { + return util.JSONResponse{ + Code: http.StatusForbidden, + JSON: jsonerror.Forbidden("State not known"), + } + } // Check if the user is already in the room. If they're already in then // there isn't much point in sending another join event into the room. diff --git a/federationapi/routing/state.go b/federationapi/routing/state.go index 6fdce20c..5377eb88 100644 --- a/federationapi/routing/state.go +++ b/federationapi/routing/state.go @@ -135,6 +135,12 @@ func getState( return nil, nil, &resErr } + if !response.StateKnown { + return nil, nil, &util.JSONResponse{ + Code: http.StatusNotFound, + JSON: jsonerror.NotFound("State not known"), + } + } if response.IsRejected { return nil, nil, &util.JSONResponse{ Code: http.StatusNotFound, |