Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 5b22d15

Browse files
committed
Fix candidate server encoding
1 parent 3bc5e2b commit 5b22d15

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/matrix-to.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export function makeEventPermalink(roomId, eventId) {
2929
// If the roomId isn't actually a room ID, don't try to list the servers.
3030
// Aliases are already routable, and don't need extra information.
3131
if (roomId[0] !== '!') return permalinkBase;
32+
3233
const serverCandidates = pickServerCandidates(roomId);
3334
return `${permalinkBase}${encodeServerCandidates(serverCandidates)}`;
3435
}
@@ -53,7 +54,7 @@ export function makeGroupPermalink(groupId) {
5354
}
5455

5556
export function encodeServerCandidates(candidates) {
56-
if (!candidates) return '';
57+
if (!candidates || candidates.length === 0) return '';
5758
return `?via=${candidates.map(c => encodeURIComponent(c)).join("&via=")}`;
5859
}
5960

0 commit comments

Comments
 (0)