From 61d7edd9297ea5c30450469b3c3e9214b02ab8e1 Mon Sep 17 00:00:00 2001 From: Parker TenBroeck <51721964+ParkerTenBroeck@users.noreply.github.com> Date: Sat, 10 Jan 2026 12:15:59 -0500 Subject: [PATCH] fixed exception for invalid share links --- web/root/src/share.ts | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/web/root/src/share.ts b/web/root/src/share.ts index 986d718..d9eaba4 100644 --- a/web/root/src/share.ts +++ b/web/root/src/share.ts @@ -21,16 +21,21 @@ btn.addEventListener("click", async () => { export function sharedText(): string|null { - const url = new URL(globalThis.window.location.href); - let text: string | null = url.searchParams.get("share"); - if (text !== null) { - text = atob(text); - url.searchParams.delete("share"); - globalThis.window.history.replaceState( - {}, - document.title, - url.pathname + url.search + url.hash - ); + try{ + const url = new URL(globalThis.window.location.href); + let text: string | null = url.searchParams.get("share"); + if (text !== null) { + text = atob(text); + url.searchParams.delete("share"); + globalThis.window.history.replaceState( + {}, + document.title, + url.pathname + url.search + url.hash + ); + } + return text; + }catch(e){ + console.log(e) } - return text; + return null; } \ No newline at end of file