More spec compliance

This commit is contained in:
Till Faelligen 2022-09-15 14:00:05 +02:00
parent a5f8c07184
commit 5b31f84c50
No known key found for this signature in database
GPG key ID: 3DF82D8AB9211D4E

View file

@ -120,6 +120,16 @@ func SendEvent(
delete(r, "join_authorised_via_users_server")
}
// As per the spec, m.room.message events require a msgtype, verify it is set
if eventType == "m.room.message" {
if _, ok := r["msgtype"]; !ok {
return util.JSONResponse{
Code: http.StatusBadRequest,
JSON: jsonerror.Unknown("'msgtype' not in content"),
}
}
}
evTime, err := httputil.ParseTSParam(req)
if err != nil {
return util.JSONResponse{