Workaround inconsistent message content type

This commit is contained in:
M66B
2021-02-20 13:58:57 +01:00
parent e73e77e471
commit b066c06813
2 changed files with 20 additions and 16 deletions

View File

@@ -2545,22 +2545,6 @@ public class MessageHelper {
try {
// From the body structure
contentType = new ContentType(part.getContentType());
// Workaround bodystructure not matching header
if (part instanceof MimeMessage &&
"text/plain".equalsIgnoreCase(contentType.getBaseType()))
try {
String[] c = part.getHeader("Content-type");
if (c != null && c.length > 0) {
ContentType ct = new ContentType(c[0]);
if ("text/html".equalsIgnoreCase(ct.getBaseType())) {
Log.e("Inconsistent bs=" + contentType + " header=" + ct);
contentType = ct;
}
}
} catch (MessagingException ex) {
Log.w(ex);
}
} catch (ParseException ex) {
if (part instanceof MimeMessage)
Log.w("MimeMessage content type=" + ex.getMessage());