mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-23 14:53:10 -06:00
Revert some changes from wrong branch
This commit is contained in:
parent
252830b2b0
commit
e846ae0e5d
|
|
@ -1,28 +0,0 @@
|
|||
package helpers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
)
|
||||
|
||||
// SanityCheckEvent looks for any obvious problems with the event before
|
||||
// we bother to continue processing it any further.
|
||||
func SanityCheckEvent(event *gomatrixserverlib.Event) error {
|
||||
switch event.Type() {
|
||||
case gomatrixserverlib.MRoomCreate:
|
||||
var content gomatrixserverlib.CreateContent
|
||||
if err := json.Unmarshal(event.Content(), &content); err != nil {
|
||||
return fmt.Errorf("Failed to unmarshal content of create event %q", event.EventID())
|
||||
}
|
||||
|
||||
// Check that the room version is supported.
|
||||
if content.RoomVersion != nil {
|
||||
if _, err := content.RoomVersion.EventFormat(); err != nil {
|
||||
return fmt.Errorf("Room version %q is unsupported in create event %q", *content.RoomVersion, event.EventID())
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
@ -44,17 +44,6 @@ func (r *Inputer) processRoomEvent(
|
|||
headered := input.Event
|
||||
event := headered.Unwrap()
|
||||
|
||||
// Run sanity checks against the event. This will catch any really
|
||||
// obvious problems.
|
||||
if err = helpers.SanityCheckEvent(&event); err != nil {
|
||||
logrus.WithFields(logrus.Fields{
|
||||
"event_id": event.EventID(),
|
||||
"type": event.Type(),
|
||||
"room": event.RoomID(),
|
||||
}).WithError(err).Info("Event failed sanity-checks")
|
||||
return
|
||||
}
|
||||
|
||||
// Check that the event passes authentication checks and work out
|
||||
// the numeric IDs for the auth events.
|
||||
isRejected := false
|
||||
|
|
|
|||
Loading…
Reference in a new issue