Merge pull request #860 from vector-im/dbkr/lowercase_room_alias

Lowercase room alias before joining
This commit is contained in:
David Baker 2023-01-20 09:43:28 +00:00 committed by GitHub
commit c2883e52bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View file

@ -211,6 +211,12 @@ export function fullAliasFromRoomName(
return `#${roomAliasLocalpartFromRoomName(roomName)}:${client.getDomain()}`;
}
/**
* XXX: What is this trying to do? It looks like it's getting the localpart from
* a room alias, but why is it splitting on hyphens and then putting spaces in??
* @param roomId
* @returns
*/
export function roomNameFromRoomId(roomId: string): string {
return roomId
.match(/([^:]+):.*$/)[1]

View file

@ -52,7 +52,11 @@ export const useLoadGroupCall = (
const fetchOrCreateRoom = async (): Promise<Room> => {
try {
const room = await client.joinRoom(roomIdOrAlias, { viaServers });
// We lowercase the localpart when we create the room, so we must lowercase
// it here too (we just do the whole alias).
const room = await client.joinRoom(roomIdOrAlias.toLowerCase(), {
viaServers,
});
logger.info(
`Joined ${roomIdOrAlias}, waiting room to be ready for group calls`
);