From 1c1f79195e8f03bd16367bb2eee554d9f24119ab Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 6 Feb 2019 12:16:33 +0000 Subject: [PATCH] Revert "Attempt to fix broken encodings" This reverts commit 0b08d00d610b63b6d8daff6fa69d094c6cca6c9e. --- .../java/eu/faircode/email/MessageHelper.java | 38 ------------------- 1 file changed, 38 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java index 2847453cc3..af478a5453 100644 --- a/app/src/main/java/eu/faircode/email/MessageHelper.java +++ b/app/src/main/java/eu/faircode/email/MessageHelper.java @@ -35,7 +35,6 @@ import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; import java.util.ArrayList; -import java.util.Arrays; import java.util.Date; import java.util.Enumeration; import java.util.List; @@ -59,7 +58,6 @@ import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; -import javax.mail.internet.MimePart; import javax.mail.internet.MimeUtility; import javax.mail.internet.ParseException; @@ -72,13 +70,6 @@ public class MessageHelper { static final int ATTACHMENT_BUFFER_SIZE = 8192; // bytes - private static final List ENCODINGS = Arrays.asList( - "base64", - "quoted-printable", - "uuencode", "x-uuencode", "x-uue", - "binary", "7bit", "8bit" - ); - static Properties getSessionProperties(int auth_type, String realm, boolean insecure) { Properties props = new Properties(); @@ -604,8 +595,6 @@ public class MessageHelper { Part part = (html == null ? plain : html); try { - fixEncoding((MimePart) part); - Object content = part.getContent(); if (content instanceof String) result = (String) content; @@ -644,33 +633,6 @@ public class MessageHelper { return result; } - private void fixEncoding(MimePart part) throws MessagingException { - String mencoding = part.getEncoding(); - if (mencoding == null || ENCODINGS.contains(mencoding)) - return; - - String cte = part.getHeader("Content-Transfer-Encoding")[0]; - Log.i("Attempting to fix encoding=" + cte); - - for (String encoding : ENCODINGS) { - boolean contains = true; - for (String pencoding : encoding.split("-")) - contains = (contains && mencoding.toLowerCase().contains(pencoding)); - - if (contains) { - String warning = "Changed invalid encoding " + cte + " to " + encoding; - Log.w(warning); - warnings.add(warning); - part.setHeader("Content-Transfer-Encoding", encoding); - return; - } - } - - String warning = "Unfixable encoding " + cte; - Log.w(warning); - warnings.add(warning); - } - List getAttachments() throws MessagingException { List result = new ArrayList<>();