Skip to content

Commit

Permalink
Fix encoding issue
Browse files Browse the repository at this point in the history
Fixes #7 using a Blob rather than btoa (as btoa() creates a Base64-encoded ASCII string).

Side modifiation, the {{VALUES}}\n substitution does not works on my environnement as the substituion is searching for a litteral \n in the template. Feel free to remove this modification if it's not relevant and I juste missed something along the way :-)
  • Loading branch information
TeddyBear06 authored and mprimi committed Jan 11, 2023
1 parent 9d81e1e commit 3fad300
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions creator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,10 @@

secretPage = pageTemplate
secretPage = secretPage.replaceAll("{{PASSWORD_HINT}}", passwordHint)
secretPage = secretPage.replaceAll("{{VALUES}}\n", values)
secretPage = secretPage.replaceAll("{{VALUES}}", values)

const dataURI = "data:application/octet-stream;base64," + btoa(secretPage)
document.getElementById("target_link").setAttribute("href", dataURI)
var blob = new Blob([secretPage], {'type':'text/html'});
document.getElementById("target_link").setAttribute("href", window.URL.createObjectURL(blob))
document.getElementById("target_link").hidden = false

setMessage("✅ Ready for download")
Expand Down

0 comments on commit 3fad300

Please sign in to comment.