From 5b22d157a7871440b4fcc593313aada12b852faa Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 26 Oct 2018 20:34:06 -0600 Subject: [PATCH] Fix candidate server encoding --- src/matrix-to.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/matrix-to.js b/src/matrix-to.js index c0b57e725d..b5827f671a 100644 --- a/src/matrix-to.js +++ b/src/matrix-to.js @@ -29,6 +29,7 @@ export function makeEventPermalink(roomId, eventId) { // If the roomId isn't actually a room ID, don't try to list the servers. // Aliases are already routable, and don't need extra information. if (roomId[0] !== '!') return permalinkBase; + const serverCandidates = pickServerCandidates(roomId); return `${permalinkBase}${encodeServerCandidates(serverCandidates)}`; } @@ -53,7 +54,7 @@ export function makeGroupPermalink(groupId) { } export function encodeServerCandidates(candidates) { - if (!candidates) return ''; + if (!candidates || candidates.length === 0) return ''; return `?via=${candidates.map(c => encodeURIComponent(c)).join("&via=")}`; }