mirror of
https://github.com/element-hq/dendrite.git
synced 2026-01-11 19:46:30 +00:00
Fix creating rooms when the default is set to v12 (#3670)
Some checks are pending
Dendrite / WASM build test (push) Waiting to run
Dendrite / Linting (push) Waiting to run
Dendrite / Unit tests (push) Waiting to run
Dendrite / Build for Linux (push) Waiting to run
Dendrite / Build for Windows (push) Waiting to run
Dendrite / Initial tests passed (push) Blocked by required conditions
Dendrite / Integration tests (push) Blocked by required conditions
Dendrite / Upgrade tests (push) Blocked by required conditions
Dendrite / Upgrade tests from HEAD-2 (push) Blocked by required conditions
Dendrite / Sytest (SQLite Cgo) (push) Blocked by required conditions
Dendrite / Sytest (PostgreSQL) (push) Blocked by required conditions
Dendrite / Sytest (SQLite native) (push) Blocked by required conditions
Dendrite / Complement (PostgreSQL) (push) Blocked by required conditions
Dendrite / Complement (SQLite native) (push) Blocked by required conditions
Dendrite / Complement (SQLite Cgo) (push) Blocked by required conditions
Dendrite / Integration tests passed (push) Blocked by required conditions
Dendrite / Update Docker images (push) Blocked by required conditions
Some checks are pending
Dendrite / WASM build test (push) Waiting to run
Dendrite / Linting (push) Waiting to run
Dendrite / Unit tests (push) Waiting to run
Dendrite / Build for Linux (push) Waiting to run
Dendrite / Build for Windows (push) Waiting to run
Dendrite / Initial tests passed (push) Blocked by required conditions
Dendrite / Integration tests (push) Blocked by required conditions
Dendrite / Upgrade tests (push) Blocked by required conditions
Dendrite / Upgrade tests from HEAD-2 (push) Blocked by required conditions
Dendrite / Sytest (SQLite Cgo) (push) Blocked by required conditions
Dendrite / Sytest (PostgreSQL) (push) Blocked by required conditions
Dendrite / Sytest (SQLite native) (push) Blocked by required conditions
Dendrite / Complement (PostgreSQL) (push) Blocked by required conditions
Dendrite / Complement (SQLite native) (push) Blocked by required conditions
Dendrite / Complement (SQLite Cgo) (push) Blocked by required conditions
Dendrite / Integration tests passed (push) Blocked by required conditions
Dendrite / Update Docker images (push) Blocked by required conditions
This should fix https://github.com/element-hq/dendrite/issues/3669 We'd potentially send an empty string to `GenerateCreateContent`, even if we set the correct `roomVersion` before. ### Pull Request Checklist <!-- Please read https://matrix-org.github.io/dendrite/development/contributing before submitting your pull request --> * [x] I have added Go unit tests or [Complement integration tests](https://github.com/matrix-org/complement) for this PR _or_ I have justified why this PR doesn't need tests * [x] Pull request includes a [sign off below](https://element-hq.github.io/dendrite/development/contributing#sign-off) _or_ I have already signed off privately --------- Signed-off-by: Till Faelligen <2353100+S7evinK@users.noreply.github.com>
This commit is contained in:
parent
12b7038989
commit
68458c139d
6 changed files with 8 additions and 7 deletions
|
|
@ -200,7 +200,7 @@ func createRoom(
|
|||
if createRequest.Preset == spec.PresetTrustedPrivateChat {
|
||||
additionalCreators = createRequest.Invite
|
||||
}
|
||||
createContent, err := roomserverAPI.GenerateCreateContent(ctx, createRequest.RoomVersion, userID.String(), createRequest.CreationContent, additionalCreators)
|
||||
createContent, err := roomserverAPI.GenerateCreateContent(ctx, roomVersion, userID.String(), createRequest.CreationContent, additionalCreators)
|
||||
if err != nil {
|
||||
util.GetLogger(ctx).WithError(err).Error("GenerateCreateContent failed")
|
||||
return util.JSONResponse{
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ func Backfill(
|
|||
var err error
|
||||
|
||||
// Check the room ID's format.
|
||||
if _, _, err = gomatrixserverlib.SplitID('!', roomID); err != nil {
|
||||
if _, err = spec.NewRoomID(roomID); err != nil {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: spec.MissingParam("Bad room ID: " + err.Error()),
|
||||
|
|
|
|||
|
|
@ -394,10 +394,11 @@ func sendToRemoteServer(
|
|||
}
|
||||
// Fallback to the room's server if the sender's domain is the same as
|
||||
// the current server's
|
||||
_, remoteServers[1], err = gomatrixserverlib.SplitID('!', inv.RoomID)
|
||||
roomID, err := spec.NewRoomID(inv.RoomID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
remoteServers[1] = roomID.Domain()
|
||||
|
||||
for _, server := range remoteServers {
|
||||
err = federation.ExchangeThirdPartyInvite(ctx, cfg.Matrix.ServerName, server, proto)
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ func (r *Admin) PerformAdminPurgeRoom(
|
|||
roomID string,
|
||||
) error {
|
||||
// Validate we actually got a room ID and nothing else
|
||||
if _, _, err := gomatrixserverlib.SplitID('!', roomID); err != nil {
|
||||
if _, err := spec.NewRoomID(roomID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,11 +114,11 @@ func (r *Peeker) performPeekRoomByID(
|
|||
roomID = req.RoomIDOrAlias
|
||||
|
||||
// Get the domain part of the room ID.
|
||||
_, domain, err := gomatrixserverlib.SplitID('!', roomID)
|
||||
specRoomID, err := spec.NewRoomID(roomID)
|
||||
if err != nil {
|
||||
return "", api.ErrInvalidID{Err: fmt.Errorf("room ID %q is invalid: %w", roomID, err)}
|
||||
}
|
||||
|
||||
domain := specRoomID.Domain()
|
||||
// handle federated peeks
|
||||
// FIXME: don't create an outbound peek if we already have one going.
|
||||
if !r.Cfg.Matrix.IsLocalServerName(domain) {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ func (r *Unpeeker) performUnpeekRoomByID(
|
|||
roomID, userID, deviceID string,
|
||||
) (err error) {
|
||||
// Get the domain part of the room ID.
|
||||
_, _, err = gomatrixserverlib.SplitID('!', roomID)
|
||||
_, err = spec.NewRoomID(roomID)
|
||||
if err != nil {
|
||||
return api.ErrInvalidID{Err: fmt.Errorf("room ID %q is invalid: %w", roomID, err)}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue