Send correct server name to FS API

This commit is contained in:
Neil Alexander 2020-05-01 16:16:41 +01:00
parent f946de5f7c
commit 913f2ab8c1

View file

@ -117,7 +117,8 @@ 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.
if _, domain, derr := gomatrixserverlib.SplitID('!', req.RoomIDOrAlias); derr != nil { _, domain, derr := gomatrixserverlib.SplitID('!', req.RoomIDOrAlias)
if derr != nil {
return fmt.Errorf("room ID %q in incorrect format", req.RoomIDOrAlias) return fmt.Errorf("room ID %q in incorrect format", req.RoomIDOrAlias)
} else if domain == r.Cfg.Matrix.ServerName { } 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)
@ -126,10 +127,10 @@ func (r *RoomserverInternalAPI) performJoinRoomByID(
// Otherwise, if we've reached this point, the room isn't a local room // Otherwise, if we've reached this point, the room isn't a local room
// and we should ask the federation sender to try and join for us. // and we should ask the federation sender to try and join for us.
fedReq := fsAPI.PerformJoinRequest{ fedReq := fsAPI.PerformJoinRequest{
RoomID: req.RoomIDOrAlias, RoomID: req.RoomIDOrAlias, // the room ID to try and join
UserID: req.UserID, UserID: req.UserID, // the user ID joining the room
ServerName: r.Cfg.Matrix.ServerName, ServerName: domain, // the server to try joining with
Content: req.Content, Content: req.Content, // the membership event content
} }
fedRes := fsAPI.PerformJoinResponse{} fedRes := fsAPI.PerformJoinResponse{}
err = r.fsAPI.PerformJoin(ctx, &fedReq, &fedRes) err = r.fsAPI.PerformJoin(ctx, &fedReq, &fedRes)