Workaround wrong attachment content types

This commit is contained in:
M66B 2019-09-28 13:22:52 +02:00
parent 59abad45ba
commit a36e260ac6
1 changed files with 10 additions and 9 deletions

View File

@ -1224,9 +1224,9 @@ public class MessageHelper {
// For example, sometimes PDF files are sent as application/octet-stream // For example, sometimes PDF files are sent as application/octet-stream
if (!apart.pgp) { if (!apart.pgp) {
String extension = Helper.getExtension(apart.attachment.name); String extension = Helper.getExtension(apart.attachment.name);
if (extension != null && if (extension != null) {
("pdf".equals(extension.toLowerCase(Locale.ROOT)) || if ("application/zip".equals(apart.attachment.type) ||
"application/octet-stream".equals(apart.attachment.type))) { "application/octet-stream".equals(apart.attachment.type)) {
String type = MimeTypeMap.getSingleton() String type = MimeTypeMap.getSingleton()
.getMimeTypeFromExtension(extension.toLowerCase(Locale.ROOT)); .getMimeTypeFromExtension(extension.toLowerCase(Locale.ROOT));
if (type != null) { if (type != null) {
@ -1236,6 +1236,7 @@ public class MessageHelper {
} }
} }
} }
}
if (apart.attachment.size <= 0) if (apart.attachment.size <= 0)
apart.attachment.size = null; apart.attachment.size = null;