Correctly handle alternative text formats

pull/147/head
M66B 6 years ago
parent 9fde8fa0b5
commit eedb0f34de

@ -38,7 +38,6 @@ None at this moment.
* Automatically go to the next message on deleting a message: since the 'next' message can either be an older or a newer message this would be confusing. You can disable auto closing in the advanced options and use the bottom navigation bar instead.
* Rich text editor: besides that very few people would use this on a small mobile device, Android doesn't support a rich text editor and most rich text editor open source projects are abandoned.
* Widget to read e-mail: widgets can have limited user interaction only, so a widget to read e-mail would not be very useful. Moreover, it would be not very useful to duplicate functions which are already available in the app.
* Calendar events: opening the attached calendar file should open the related calendar app.
* Executing filter rules: filter rules should be executed on the server because a battery powered device with possibly an unstable internet connection is not suitable for this.
* Badge count: there is no standard Android API for this and third party solutions might stop working anytime. For example *ShortcutBadger* [has lots of problems](https://github.com/leolin310148/ShortcutBadger/issues). You can use the provided widget instead.
* Switch language: although it is possible to change the language of an app, Android is not designed for this. Better fix the translation in your language if needed, see [this FAQ](#user-content-faq26) about how to.

@ -519,7 +519,7 @@ public class MessageHelper {
}
private static String getHtml(Part part) throws MessagingException, IOException {
if (part.isMimeType("text/*")) {
if (part.isMimeType("text/plain") || part.isMimeType("text/html")) {
String s;
try {
Object content = part.getContent();
@ -654,7 +654,7 @@ public class MessageHelper {
}
if (Part.ATTACHMENT.equalsIgnoreCase(disposition) ||
part.isMimeType("image/*") ||
!(part.isMimeType("text/plain") || part.isMimeType("text/html")) ||
!TextUtils.isEmpty(filename)) {
ContentType ct = new ContentType(part.getContentType());
String[] cid = part.getHeader("Content-ID");
@ -668,10 +668,12 @@ public class MessageHelper {
attachment.encryption = (pgp ? EntityAttachment.PGP_MESSAGE : null);
attachment.part = part;
if (TextUtils.isEmpty(attachment.name) && "text/calendar".equals(attachment.type))
attachment.name = "invite.ics";
// Try to guess a better content type
// Sometimes PDF files are sent using the wrong type
if ("application/octet-stream".equals(attachment.type) ||
"message/disposition-notification".equals(attachment.type)) {
if ("application/octet-stream".equals(attachment.type)) {
String extension = Helper.getExtension(attachment.name);
if (extension != null) {
String type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension.toLowerCase());

Loading…
Cancel
Save