Fix return error on m.room.tombstone handling in client API

This commit is contained in:
Neil Alexander 2022-04-04 17:21:30 +01:00
parent 5d62b8f2cd
commit 38ed60c8db
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -278,8 +278,10 @@ func generateSendEvent(
content := make(map[string]interface{})
if err = json.Unmarshal(e.Content(), &content); err != nil {
util.GetLogger(ctx).WithError(err).Error("Cannot unmarshal the event content.")
resErr := jsonerror.InternalServerError()
return nil, &resErr
return nil, &util.JSONResponse{
Code: http.StatusBadRequest,
JSON: jsonerror.BadJSON("Cannot unmarshal the event content."),
}
}
if content["replacement_room"] == e.RoomID() {
return nil, &util.JSONResponse{