From 0ca4d66a504f46f8390a9bce8d35de03ce031739 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 29 May 2022 15:43:07 +0200 Subject: [PATCH] Properly pass vias to Element clients Should fix joining rooms by roomid via matrix.to. fixes #270 Signed-off-by: Nicolas Werner --- src/open/clients/Element.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/open/clients/Element.js b/src/open/clients/Element.js index 453e286..ffddfe1 100644 --- a/src/open/clients/Element.js +++ b/src/open/clients/Element.js @@ -64,6 +64,11 @@ export class Element { fragmentPath = `room/${link.identifier}/${link.eventId}`; break; } + + if ((link.kind === LinkKind.Event || link.kind === LinkKind.Room) && link.servers.length > 0) { + fragmentPath += '?' + link.servers.map(server => `via=${encodeURIComponent(server)}`).join('&'); + } + const isWebPlatform = platform === Platform.DesktopWeb || platform === Platform.MobileWeb; if (isWebPlatform || platform === Platform.iOS) { let instanceHost = trustedWebInstances[0];