convert to base64 before encryption

This commit is contained in:
Mylloon 2022-10-28 22:20:30 +02:00
parent 9981d9bb3d
commit 15c67e403f
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 8 additions and 5 deletions

View file

@ -35,9 +35,9 @@ const main = () => {
);
// Send the file to the user
const blob = new Blob([decrypted_file], {
type: "application/json",
});
const blob = new Blob([
atob(decrypted_file.split(";base64,").pop()),
]);
const url = URL.createObjectURL(blob);
download(url, decrypted_filename);
} else {

View file

@ -70,7 +70,10 @@ const update = (element, text, tag = undefined) => {
* @param file File to send
*/
const send = (file, element) => {
file.text().then((content) => {
let reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => {
const content = reader.result.split(";base64,").pop();
const req = new XMLHttpRequest();
element = update(element, "Génération des clefs...", "H3");
@ -135,5 +138,5 @@ const send = (file, element) => {
}
};
});
});
};
};