]> git.amazingca.dev Git - autumn/todo/commitdiff
Encode URI data to allow for unicode characters
authorAmazingca <autumn@amazingca.dev>
Tue, 12 May 2026 20:16:59 +0000 (14:16 -0600)
committerAmazingca <autumn@amazingca.dev>
Tue, 12 May 2026 20:16:59 +0000 (14:16 -0600)
app/settings.js
app/todos.js

index bd413fd56458167f15de395d2fbf366de5338a6d..81707f482e09738167093916065a0ddbacab72cb 100644 (file)
@@ -34,7 +34,7 @@ document.getElementById("exportData").addEventListener("click", async (event) =>
     theme: theme
   };
 
-  const exportURL = window.location.href.replace("settings", "").replace(".html", "") + "index.html#" + btoa(JSON.stringify(dataExport));
+  const exportURL = window.location.href.replace("settings", "").replace(".html", "") + "index.html#" + btoa(encodeURIComponent(JSON.stringify(dataExport)));
 
   if (!window.navigator.userAgent.includes("Firefox") && !/(Linux|Windows|Mac)/g.test(window.navigator.platform)) {
     
@@ -51,13 +51,10 @@ document.getElementById("exportData").addEventListener("click", async (event) =>
       }, 2000);
     } catch (e) {
 
-      window.alert(e);
       console.error(e);
     }
   } else {
 
-    window.alert("Window not detected");
-
     navigator.clipboard.writeText(exportURL);
 
     exportDataText.innerHTML = "link copied!";
index c90b6734a77f96daae29a5315a0ca22bb03db444..fb4942175ab701cac8f099b317dddc3ee0633ca8 100644 (file)
@@ -35,7 +35,7 @@ if (window.location.hash.length > 0) {
 
   try {
 
-    ({todos, archived, theme} = JSON.parse(atob(window.location.hash.substring(1)))); // using parenthesis around this is required because we're doing object literal destructuring without a declaration
+    ({todos, archived, theme} = JSON.parse(decodeURIComponent(atob(window.location.hash.substring(1))))); // using parenthesis around this is required because we're doing object literal destructuring without a declaration
 
     backupData();
   } catch (e) {