diff --git a/src/public/js/download.js b/src/public/js/download.js index e891e30..503f485 100644 --- a/src/public/js/download.js +++ b/src/public/js/download.js @@ -36,7 +36,7 @@ const main = () => { // Send the file to the user const blob = new Blob([ - atob(decrypted_file.split(";base64,").pop()), + decodeURIComponent(atob(decrypted_file)), ]); const url = URL.createObjectURL(blob); download(url, decrypted_filename); diff --git a/src/public/js/index.js b/src/public/js/index.js index 1901bf9..5dfaa9c 100644 --- a/src/public/js/index.js +++ b/src/public/js/index.js @@ -71,9 +71,9 @@ const update = (element, text, tag = undefined) => { */ const send = (file, element) => { let reader = new FileReader(); - reader.readAsDataURL(file); + reader.readAsText(file); reader.onload = () => { - const content = reader.result.split(";base64,").pop(); + const content = btoa(encodeURIComponent(reader.result)); if (file.size > 512000 || file.size == 0) { let message = file.size == 0 ? "vide" : "trop lourd (max ~500ko)";