Do not rely on RoomAlias constructor to validate the Room alias, since there is no validation in release mode.

This is fixing the test in release mode.
This commit is contained in:
Benoit Marty 2025-02-05 18:05:10 +01:00
parent 39b51b4904
commit 070fd4f53a
3 changed files with 10 additions and 7 deletions

View file

@ -99,7 +99,7 @@ class EditRoomAddressPresenter @AssistedInject constructor(
suspend {
val savedCanonicalAlias = room.canonicalAlias
val savedAliasFromHomeserver = room.firstAliasMatching(serverName)
val newRoomAlias = client.roomAliasFromName(newRoomAddress).getOrThrow()
val newRoomAlias = client.roomAliasFromName(newRoomAddress) ?: throw IllegalArgumentException("Invalid room address")
// First publish the new alias in the room directory
room.publishRoomAliasInRoomDirectory(newRoomAlias).getOrThrow()