Fix 500s on /state, /state_ids when state not known (#2672)

This was due to bad error bubbling.
This commit is contained in:
Neil Alexander 2022-08-25 09:51:36 +01:00 committed by GitHub
parent 522bd2999f
commit 16156b0b09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 7 deletions

View file

@ -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.

View file

@ -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,