diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-06-29 12:32:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-29 12:32:24 +0100 |
commit | 2dea466685d0d4ab74d4cbd84af16b621d1269b3 (patch) | |
tree | 007dd3f904cb6ad1a5e52b851d1d23d102db3323 /roomserver/internal | |
parent | 2086992caf67d033c42db3fb6bc5c2a294e72bfe (diff) |
Return an error if trying to invite a malformed user ID (#2543)
Diffstat (limited to 'roomserver/internal')
-rw-r--r-- | roomserver/internal/perform/perform_invite.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/roomserver/internal/perform/perform_invite.go b/roomserver/internal/perform/perform_invite.go index b0148a31..644c954b 100644 --- a/roomserver/internal/perform/perform_invite.go +++ b/roomserver/internal/perform/perform_invite.go @@ -56,7 +56,14 @@ func (r *Inviter) PerformInvite( return nil, fmt.Errorf("failed to load RoomInfo: %w", err) } - _, domain, _ := gomatrixserverlib.SplitID('@', targetUserID) + _, domain, err := gomatrixserverlib.SplitID('@', targetUserID) + if err != nil { + res.Error = &api.PerformError{ + Code: api.PerformErrorBadRequest, + Msg: fmt.Sprintf("The user ID %q is invalid!", targetUserID), + } + return nil, nil + } isTargetLocal := domain == r.Cfg.Matrix.ServerName isOriginLocal := event.Origin() == r.Cfg.Matrix.ServerName |