From b302bd6829c416a5deb9015a1a125f6ee4919c2a Mon Sep 17 00:00:00 2001 From: James Salter Date: Wed, 24 Nov 2021 17:14:26 +1100 Subject: [PATCH 1/2] Apply URL encoding to the fragmentPath According to RFC3986 section 3.5, only certain values are legal in the fragment. # in particular isn't one of them, but this is a character that appears in room names. It shouldn't hurt to escape other, otherwise legal characters in the fragment such as @ and :. --- src/open/clients/Element.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/open/clients/Element.js b/src/open/clients/Element.js index 0d54946..56357db 100644 --- a/src/open/clients/Element.js +++ b/src/open/clients/Element.js @@ -74,9 +74,9 @@ export class Element { } return `https://${instanceHost}/#/${fragmentPath}`; } else if (platform === Platform.Linux || platform === Platform.Windows || platform === Platform.macOS) { - return `element://vector/webapp/#/${fragmentPath}`; + return `element://vector/webapp/#/${encodeURIComponent(fragmentPath)}`; } else { - return `element://${fragmentPath}`; + return `element://${encodeURIComponent(fragmentPath)}`; } } From c378eb4b4a4a67639f51a8afd717c0cb115eef11 Mon Sep 17 00:00:00 2001 From: James Salter Date: Wed, 24 Nov 2021 19:15:46 +1100 Subject: [PATCH 2/2] missed a spot --- src/open/clients/Element.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/open/clients/Element.js b/src/open/clients/Element.js index 56357db..8317e29 100644 --- a/src/open/clients/Element.js +++ b/src/open/clients/Element.js @@ -72,7 +72,7 @@ export class Element { if (isWebPlatform && trustedWebInstances.includes(link.webInstances[this.id])) { instanceHost = link.webInstances[this.id]; } - return `https://${instanceHost}/#/${fragmentPath}`; + return `https://${instanceHost}/#/${encodeURIComponent(fragmentPath)}`; } else if (platform === Platform.Linux || platform === Platform.Windows || platform === Platform.macOS) { return `element://vector/webapp/#/${encodeURIComponent(fragmentPath)}`; } else {