From 5b4322c9648fa5da98e6053f85a6f38ec5a70366 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Thu, 2 May 2024 22:39:39 +0200 Subject: [PATCH] fix: url parsing with extra params --- website/src/repl/util.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/src/repl/util.mjs b/website/src/repl/util.mjs index 6dba7dab..3147ae38 100644 --- a/website/src/repl/util.mjs +++ b/website/src/repl/util.mjs @@ -26,13 +26,13 @@ export async function initCode() { // load code from url hash (either short hash from database or decode long hash) try { const initialUrl = window.location.href; - const hash = initialUrl.split('?')[1]?.split('#')?.[0]; + const hash = initialUrl.split('?')[1]?.split('#')?.[0]?.split('&')[0]; const codeParam = window.location.href.split('#')[1] || ''; - // looking like https://strudel.cc/?J01s5i1J0200 (fixed hash length) if (codeParam) { // looking like https://strudel.cc/#ImMzIGUzIg%3D%3D (hash length depends on code length) return hash2code(codeParam); } else if (hash) { + // looking like https://strudel.cc/?J01s5i1J0200 (fixed hash length) return supabase .from('code_v1') .select('code')