1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-30 11:45:36 +00:00

Workaround lost S/MIME parts

This commit is contained in:
M66B 2022-10-27 21:50:09 +02:00
parent cbb654e24a
commit 29d7c1c339

View file

@ -1187,6 +1187,24 @@ class Core {
if (!message.content)
throw new IllegalArgumentException("Message body missing");
List<EntityAttachment> attachments = db.attachment().getAttachments(message.id);
for (EntityAttachment attachment : attachments)
if (EntityAttachment.SMIME_SIGNATURE.equals(attachment.encryption))
for (EntityAttachment content : attachments)
if (EntityAttachment.SMIME_CONTENT.equals(content.encryption)) {
boolean afile = attachment.getFile(context).exists();
boolean cfile = content.getFile(context).exists();
if (!attachment.available || !afile || !content.available || !cfile) {
Log.e("S/MIME vanished" +
" available=" + attachment.available + "/" + content.available +
" file=" + afile + "/" + cfile);
db.attachment().setAvailable(attachment.id, false);
db.attachment().setAvailable(content.id, false);
db.attachment().setEncryption(attachment.id, null);
db.attachment().setEncryption(content.id, null);
}
}
imessage = MessageHelper.from(context, message, null, isession, false);
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {