From b854cbe8d35f8ca81a8f9f7f7e41ce04e614ed38 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 17 Nov 2019 11:11:26 +0100 Subject: [PATCH] Workaround mime types with removed dots --- .../main/java/eu/faircode/email/EntityAttachment.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EntityAttachment.java b/app/src/main/java/eu/faircode/email/EntityAttachment.java index 4070084897..1387477eb8 100644 --- a/app/src/main/java/eu/faircode/email/EntityAttachment.java +++ b/app/src/main/java/eu/faircode/email/EntityAttachment.java @@ -160,13 +160,18 @@ public class EntityAttachment { if (extension == null) return type; + String gtype = MimeTypeMap.getSingleton() + .getMimeTypeFromExtension(extension.toLowerCase(Locale.ROOT)); + + // Some servers remove dots from mime types + if (gtype != null && gtype.replace(".", "").equals(type)) + return gtype; + if ("application/zip".equals(type) || "application/octet-stream".equals(type)) { if ("log".equalsIgnoreCase(extension)) return "text/plain"; - String gtype = MimeTypeMap.getSingleton() - .getMimeTypeFromExtension(extension.toLowerCase(Locale.ROOT)); if (gtype == null || gtype.equals(type)) return type;