mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-17 11:53:09 -06:00
Fix local server checks
This commit is contained in:
parent
f53dffc02a
commit
cc5d1ee213
|
|
@ -66,9 +66,9 @@ func (r *RoomserverInternalAPI) performJoinRoomByID(
|
||||||
res *api.PerformJoinResponse, // nolint:unparam
|
res *api.PerformJoinResponse, // nolint:unparam
|
||||||
) error {
|
) error {
|
||||||
// Get the domain part of the room ID.
|
// Get the domain part of the room ID.
|
||||||
_, domain, err := gomatrixserverlib.SplitID('#', req.RoomIDOrAlias)
|
_, domain, err := gomatrixserverlib.SplitID('!', req.RoomIDOrAlias)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("supplied room alias %q in incorrect format", req.RoomIDOrAlias)
|
return fmt.Errorf("supplied room ID %q in incorrect format", req.RoomIDOrAlias)
|
||||||
}
|
}
|
||||||
req.ServerNames = append(req.ServerNames, domain)
|
req.ServerNames = append(req.ServerNames, domain)
|
||||||
|
|
||||||
|
|
@ -134,10 +134,7 @@ func (r *RoomserverInternalAPI) performJoinRoomByID(
|
||||||
// The room doesn't exist. First of all check if the room is a local
|
// The room doesn't exist. First of all check if the room is a local
|
||||||
// room. If it is then there's nothing more to do - the room just
|
// room. If it is then there's nothing more to do - the room just
|
||||||
// hasn't been created yet.
|
// hasn't been created yet.
|
||||||
_, domain, derr := gomatrixserverlib.SplitID('!', req.RoomIDOrAlias)
|
if domain == r.Cfg.Matrix.ServerName {
|
||||||
if derr != nil {
|
|
||||||
return fmt.Errorf("room ID %q in incorrect format", req.RoomIDOrAlias)
|
|
||||||
} else if domain == r.Cfg.Matrix.ServerName {
|
|
||||||
return fmt.Errorf("error trying to join %q room: %w", req.RoomIDOrAlias, derr)
|
return fmt.Errorf("error trying to join %q room: %w", req.RoomIDOrAlias, derr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue