From 38ed60c8db63ed0c06c1c321ad83c873fa28e90d Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 4 Apr 2022 17:21:30 +0100 Subject: [PATCH] Fix return error on `m.room.tombstone` handling in client API --- clientapi/routing/sendevent.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/clientapi/routing/sendevent.go b/clientapi/routing/sendevent.go index 0d80e3089..c5884e80b 100644 --- a/clientapi/routing/sendevent.go +++ b/clientapi/routing/sendevent.go @@ -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{