Fixed decryption

This commit is contained in:
M66B 2019-09-07 18:16:44 +02:00
parent 2a38a42f44
commit a4dd59c97c
1 changed files with 12 additions and 8 deletions

View File

@ -1059,8 +1059,10 @@ public class MessageHelper {
try { try {
ContentType ct = new ContentType(cpart.getContentType()); ContentType ct = new ContentType(cpart.getContentType());
if ("application/pgp-encrypted".equals(ct.getBaseType().toLowerCase())) if ("application/pgp-encrypted".equals(ct.getBaseType().toLowerCase())) {
pgp = true; pgp = true;
continue;
}
} catch (ParseException ex) { } catch (ParseException ex) {
Log.w(ex); Log.w(ex);
} }
@ -1144,13 +1146,15 @@ public class MessageHelper {
// Try to guess a better content type // Try to guess a better content type
// For example, sometimes PDF files are sent as application/octet-stream // For example, sometimes PDF files are sent as application/octet-stream
String extension = Helper.getExtension(apart.attachment.name); if (!apart.pgp) {
if (extension != null) { String extension = Helper.getExtension(apart.attachment.name);
String type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension.toLowerCase()); if (extension != null) {
if (type != null) { String type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension.toLowerCase());
if (!type.equals(apart.attachment.type)) if (type != null) {
Log.w("Guessing file=" + apart.attachment.name + " type=" + type); if (!type.equals(apart.attachment.type))
apart.attachment.type = type; Log.w("Guessing file=" + apart.attachment.name + " type=" + type);
apart.attachment.type = type;
}
} }
} }