diff --git a/client/embed.js b/client/embed.js index fa0a34d..78fa00c 100644 --- a/client/embed.js +++ b/client/embed.js @@ -101,13 +101,20 @@ const keyMatchRegex = /83e(0[1-9]|1[0-2])(\d\d)$/; function fixupBoardLinks (parentNode, contEleId, options) { for (const child of parentNode.childNodes) { if (child.tagName === 'A') { - const checkUrl = new URL(child.attributes.href.value); - if (!knownS83Hosts.includes(checkUrl.host)) { + let checkUrl; + try { + checkUrl = new URL(child.attributes.href.value); + } catch (err) { + // invalid URL, so nothing to fixup: skip + continue; + } + + if (!knownS83Hosts.includes(checkUrl?.host)) { return; } - const s83Key = checkUrl.pathname.replace(/^\//, ''); - if (s83Key.length !== 64) { + const s83Key = checkUrl?.pathname.replace(/^\//, ''); + if (s83Key?.length !== 64) { return; } diff --git a/client/root.tmpl.html b/client/root.tmpl.html index e3f5991..3917b9d 100644 --- a/client/root.tmpl.html +++ b/client/root.tmpl.html @@ -135,7 +135,7 @@

Publicly listed (time-to-live):

Additional unspecified functionality provided: