From 661e2a6c979266b6a8fb5d264f60d74a30b9fe38 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 6 Sep 2019 10:56:31 +0200 Subject: [PATCH] Always guess attachment type --- .../main/java/eu/faircode/email/MessageHelper.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java index 3418a79963..06f58706d4 100644 --- a/app/src/main/java/eu/faircode/email/MessageHelper.java +++ b/app/src/main/java/eu/faircode/email/MessageHelper.java @@ -1117,14 +1117,13 @@ public class MessageHelper { // Try to guess a better content type // For example, sometimes PDF files are sent as application/octet-stream - if ("application/octet-stream".equalsIgnoreCase(apart.attachment.type)) { - String extension = Helper.getExtension(apart.attachment.name); - if (extension != null) { - String type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension.toLowerCase()); - if (type != null) { + 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; - } + apart.attachment.type = type; } }