mirror of https://github.com/M66B/FairEmail.git
Workaround wrong attachment content types
This commit is contained in:
parent
59abad45ba
commit
a36e260ac6
|
@ -1224,15 +1224,16 @@ public class MessageHelper {
|
|||
// For example, sometimes PDF files are sent as application/octet-stream
|
||||
if (!apart.pgp) {
|
||||
String extension = Helper.getExtension(apart.attachment.name);
|
||||
if (extension != null &&
|
||||
("pdf".equals(extension.toLowerCase(Locale.ROOT)) ||
|
||||
"application/octet-stream".equals(apart.attachment.type))) {
|
||||
String type = MimeTypeMap.getSingleton()
|
||||
.getMimeTypeFromExtension(extension.toLowerCase(Locale.ROOT));
|
||||
if (type != null) {
|
||||
if (!type.equals(apart.attachment.type))
|
||||
Log.w("Guessing file=" + apart.attachment.name + " type=" + type);
|
||||
apart.attachment.type = type;
|
||||
if (extension != null) {
|
||||
if ("application/zip".equals(apart.attachment.type) ||
|
||||
"application/octet-stream".equals(apart.attachment.type)) {
|
||||
String type = MimeTypeMap.getSingleton()
|
||||
.getMimeTypeFromExtension(extension.toLowerCase(Locale.ROOT));
|
||||
if (type != null) {
|
||||
if (!type.equals(apart.attachment.type))
|
||||
Log.w("Guessing file=" + apart.attachment.name + " type=" + type);
|
||||
apart.attachment.type = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue