From 58f63c4afc72afb37d07fb81f56f3924dfddacc4 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 6 Jun 2022 17:11:15 +0100 Subject: [PATCH] Fix over-encoding issues in Element URIs --- src/open/clients/Element.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/open/clients/Element.js b/src/open/clients/Element.js index ffddfe1..d0d5e24 100644 --- a/src/open/clients/Element.js +++ b/src/open/clients/Element.js @@ -52,16 +52,16 @@ export class Element { let fragmentPath; switch (link.kind) { case LinkKind.User: - fragmentPath = `user/${link.identifier}`; + fragmentPath = `user/${encodeURIComponent(link.identifier)}`; break; case LinkKind.Room: - fragmentPath = `room/${link.identifier}`; + fragmentPath = `room/${encodeURIComponent(link.identifier)}`; break; case LinkKind.Group: - fragmentPath = `group/${link.identifier}`; + fragmentPath = `group/${encodeURIComponent(link.identifier)}`; break; case LinkKind.Event: - fragmentPath = `room/${link.identifier}/${link.eventId}`; + fragmentPath = `room/${encodeURIComponent(link.identifier)}/${encodeURIComponent(link.eventId)}`; break; } @@ -77,9 +77,9 @@ export class Element { if (isWebPlatform && trustedWebInstances.includes(link.webInstances[this.id])) { instanceHost = link.webInstances[this.id]; } - return `https://${instanceHost}/#/${encodeURIComponent(fragmentPath)}`; + return `https://${instanceHost}/#/${fragmentPath}`; } else if (platform === Platform.Linux || platform === Platform.Windows || platform === Platform.macOS) { - return `element://vector/webapp/#/${encodeURIComponent(fragmentPath)}`; + return `element://vector/webapp/#/${fragmentPath}`; } else { return `element://${fragmentPath}`; }