This commit is contained in:
Mylloon 2022-10-28 23:00:47 +02:00
parent da2ae85c51
commit 71bae2c750
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 3 additions and 3 deletions

View file

@ -36,7 +36,7 @@ const main = () => {
// Send the file to the user // Send the file to the user
const blob = new Blob([ const blob = new Blob([
atob(decrypted_file.split(";base64,").pop()), decodeURIComponent(atob(decrypted_file)),
]); ]);
const url = URL.createObjectURL(blob); const url = URL.createObjectURL(blob);
download(url, decrypted_filename); download(url, decrypted_filename);

View file

@ -71,9 +71,9 @@ const update = (element, text, tag = undefined) => {
*/ */
const send = (file, element) => { const send = (file, element) => {
let reader = new FileReader(); let reader = new FileReader();
reader.readAsDataURL(file); reader.readAsText(file);
reader.onload = () => { reader.onload = () => {
const content = reader.result.split(";base64,").pop(); const content = btoa(encodeURIComponent(reader.result));
if (file.size > 512000 || file.size == 0) { if (file.size > 512000 || file.size == 0) {
let message = file.size == 0 ? "vide" : "trop lourd (max ~500ko)"; let message = file.size == 0 ? "vide" : "trop lourd (max ~500ko)";