From a6b4c61dbce9cb3d9c8175be8a860840dbdcd7f7 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 10 Jul 2022 22:29:06 +0200 Subject: [PATCH] Small mime type fix --- .../eu/faircode/email/EntityAttachment.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EntityAttachment.java b/app/src/main/java/eu/faircode/email/EntityAttachment.java index d6fcc96bc0..d98234fd73 100644 --- a/app/src/main/java/eu/faircode/email/EntityAttachment.java +++ b/app/src/main/java/eu/faircode/email/EntityAttachment.java @@ -202,6 +202,17 @@ public class EntityAttachment { if (encryption != null) return type; + if ("audio/mid".equals(type)) + return "audio/midi"; + + // https://www.rfc-editor.org/rfc/rfc3555.txt + if ("image/jpg".equals(type) || "video/jpeg".equals(type)) + return "image/jpeg"; + + if (!TextUtils.isEmpty(type) && + (type.endsWith("/pdf") || type.endsWith("/x-pdf"))) + return "application/pdf"; + String extension = Helper.getExtension(name); if (extension == null) return type; @@ -300,17 +311,6 @@ public class EntityAttachment { if ("text/plain".equals(type) && "ovpn".equals(extension)) return "application/x-openvpn-profile"; - if ("audio/mid".equals(type)) - return "audio/midi"; - - // https://www.rfc-editor.org/rfc/rfc3555.txt - if ("image/jpg".equals(type) || "video/jpeg".equals(type)) - return "image/jpeg"; - - if (!TextUtils.isEmpty(type) && - (type.endsWith("/pdf") || type.endsWith("/x-pdf"))) - return "application/pdf"; - // Guess types if (gtype != null) { if (TextUtils.isEmpty(type) ||