From 6faceb07cd2b1fe5d270fc76b01eb720d84c360b Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 9 Oct 2023 16:28:48 +0100 Subject: [PATCH] Log if password needed url encoding --- src/matrix-utils.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/matrix-utils.ts b/src/matrix-utils.ts index 778e4c6a..1ed13839 100644 --- a/src/matrix-utils.ts +++ b/src/matrix-utils.ts @@ -401,11 +401,14 @@ export function getRelativeRoomUrl( ): string { // The password shouldn't need URL encoding here (we generate URL-safe ones) but encode // it in case it came from another client that generated a non url-safe one + const encodedPassword = password ? encodeURIComponent(password) : undefined; + if (password && encodedPassword !== password) { + logger.info("Encoded call password used non URL-safe chars: buggy client?"); + } + return `/room/#${ roomName ? "/" + roomAliasLocalpartFromRoomName(roomName) : "" - }?roomId=${roomId}${ - password ? "&" + PASSWORD_STRING + encodeURIComponent(password) : "" - }`; + }?roomId=${roomId}${password ? "&" + PASSWORD_STRING + encodedPassword : ""}`; } export function getAvatarUrl(