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