don't crash when file is empty

This commit is contained in:
Mylloon 2022-10-28 21:47:06 +02:00
parent 920f9bf92e
commit 9981d9bb3d
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -77,6 +77,10 @@ const send = (file, element) => {
gen_RSA_keypair(1024).then(([pub_key, sec_key]) => {
element = update(element, "Chiffrement du fichier...", "H3");
if (content.length == 0) {
update(element, "Fichier vide.", "H3");
return;
}
let data = {
file: RSA_enc(content, sec_key).join(","),
filename: RSA_enc(file.name, sec_key).join(","),