Check S/MIME content availability

pull/168/head
M66B 6 years ago
parent 031eeacd58
commit e30f6be596

@ -4379,10 +4379,15 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
File signature = null; File signature = null;
List<EntityAttachment> attachments = db.attachment().getAttachments(id); List<EntityAttachment> attachments = db.attachment().getAttachments(id);
for (EntityAttachment attachment : attachments) for (EntityAttachment attachment : attachments)
if (EntityAttachment.SMIME_SIGNATURE.equals(attachment.encryption)) if (EntityAttachment.SMIME_SIGNATURE.equals(attachment.encryption)) {
if (!attachment.available)
throw new IllegalArgumentException(context.getString(R.string.title_attachments_missing));
signature = attachment.getFile(context); signature = attachment.getFile(context);
else if (EntityAttachment.SMIME_CONTENT.equals(attachment.encryption)) } else if (EntityAttachment.SMIME_CONTENT.equals(attachment.encryption)) {
if (!attachment.available)
throw new IllegalArgumentException(context.getString(R.string.title_attachments_missing));
content = attachment.getFile(context); content = attachment.getFile(context);
}
if (content == null) if (content == null)
throw new IllegalArgumentException("Signed content missing"); throw new IllegalArgumentException("Signed content missing");
@ -4433,9 +4438,12 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
List<EntityAttachment> attachments = db.attachment().getAttachments(id); List<EntityAttachment> attachments = db.attachment().getAttachments(id);
for (EntityAttachment attachment : attachments) for (EntityAttachment attachment : attachments)
if (EntityAttachment.SMIME_MESSAGE.equals(attachment.encryption)) { if (EntityAttachment.SMIME_MESSAGE.equals(attachment.encryption)) {
if (!attachment.available)
throw new IllegalArgumentException(context.getString(R.string.title_attachments_missing));
input = attachment.getFile(context); input = attachment.getFile(context);
break; break;
} }
if (input == null) if (input == null)
throw new IllegalArgumentException("Encrypted message missing"); throw new IllegalArgumentException("Encrypted message missing");

Loading…
Cancel
Save