Merge pull request #1083 from tidalcycles/fix-urls-with-extras
fix: url parsing with extra params
This commit is contained in:
commit
deed379dba
1 changed files with 2 additions and 2 deletions
|
|
@ -26,13 +26,13 @@ export async function initCode() {
|
||||||
// load code from url hash (either short hash from database or decode long hash)
|
// load code from url hash (either short hash from database or decode long hash)
|
||||||
try {
|
try {
|
||||||
const initialUrl = window.location.href;
|
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] || '';
|
const codeParam = window.location.href.split('#')[1] || '';
|
||||||
// looking like https://strudel.cc/?J01s5i1J0200 (fixed hash length)
|
|
||||||
if (codeParam) {
|
if (codeParam) {
|
||||||
// looking like https://strudel.cc/#ImMzIGUzIg%3D%3D (hash length depends on code length)
|
// looking like https://strudel.cc/#ImMzIGUzIg%3D%3D (hash length depends on code length)
|
||||||
return hash2code(codeParam);
|
return hash2code(codeParam);
|
||||||
} else if (hash) {
|
} else if (hash) {
|
||||||
|
// looking like https://strudel.cc/?J01s5i1J0200 (fixed hash length)
|
||||||
return supabase
|
return supabase
|
||||||
.from('code_v1')
|
.from('code_v1')
|
||||||
.select('code')
|
.select('code')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue