From 80f97cba32fdb394beea07a9ffbe050ea1e62349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Wed, 9 Aug 2023 13:28:50 +0200 Subject: [PATCH] Fix `getRoomUrl()` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/matrix-utils.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/matrix-utils.ts b/src/matrix-utils.ts index 454082f7..e60f5345 100644 --- a/src/matrix-utils.ts +++ b/src/matrix-utils.ts @@ -347,16 +347,14 @@ export function getRoomUrl( roomIdOrAlias: string, password: string = "" ): string { + password = password === "" ? "" : "#" + PASSWORD_STRING + password; + if (roomIdOrAlias.startsWith("#")) { return `${window.location.protocol}//${window.location.host}/${ roomIdOrAlias.substring(1).split(":")[0] - }${password === "" ? "" : PASSWORD_STRING + password}`; + }${password}`; } else { - return `${window.location.protocol}//${ - window.location.host - }/room?roomId=${roomIdOrAlias}${ - password === "" ? "" : "#" + PASSWORD_STRING + password - }`; + return `${window.location.protocol}//${window.location.host}/room?roomId=${roomIdOrAlias}${password}`; } }