Small fix

This commit is contained in:
M66B 2019-12-23 20:01:25 +01:00
parent 2508fcfa47
commit e9bceaf26b
1 changed files with 12 additions and 9 deletions

View File

@ -2148,16 +2148,16 @@ class Core {
int sequence = 1; int sequence = 1;
String autocrypt = helper.getAutocrypt(); String autocrypt = helper.getAutocrypt();
if (autocrypt != null) if (autocrypt != null) {
try { EntityAttachment attachment = new EntityAttachment();
EntityAttachment attachment = new EntityAttachment(); attachment.message = message.id;
attachment.message = message.id; attachment.sequence = sequence++;
attachment.sequence = sequence++; attachment.name = "pubkey.pem";
attachment.name = "pubkey.pem"; attachment.type = "application/pgp-keys";
attachment.type = "application/pgp-keys"; attachment.disposition = Part.ATTACHMENT;
attachment.disposition = Part.ATTACHMENT; attachment.id = db.attachment().insertAttachment(attachment);
attachment.id = db.attachment().insertAttachment(attachment);
try {
byte[] b = Base64.decode(autocrypt, Base64.DEFAULT); byte[] b = Base64.decode(autocrypt, Base64.DEFAULT);
File file = attachment.getFile(context); File file = attachment.getFile(context);
@ -2170,7 +2170,10 @@ class Core {
db.attachment().setDownloaded(attachment.id, file.length()); db.attachment().setDownloaded(attachment.id, file.length());
} catch (IllegalArgumentException ex) { } catch (IllegalArgumentException ex) {
Log.w(ex); Log.w(ex);
db.attachment().setDownloaded(attachment.id, 0L);
db.attachment().setError(attachment.id, Log.formatThrowable(ex, false));
} }
}
List<EntityAttachment> attachments = parts.getAttachments(); List<EntityAttachment> attachments = parts.getAttachments();
for (EntityAttachment attachment : attachments) { for (EntityAttachment attachment : attachments) {