Fixed guessing attachments types

This commit is contained in:
M66B
2018-09-20 15:03:07 +00:00
parent 80a4e5ce1b
commit 679556271f
3 changed files with 14 additions and 7 deletions

View File

@@ -640,11 +640,9 @@ public class FragmentCompose extends FragmentEx {
attachment.sequence = db.attachment().getAttachmentCount(draft.id) + 1;
attachment.name = name;
String extension = null;
if (attachment.name != null) // External attach
extension = MimeTypeMap.getFileExtensionFromUrl(attachment.name.toLowerCase());
String extension = Helper.getExtension(attachment.name);
if (extension != null)
attachment.type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
attachment.type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension.toLowerCase());
if (attachment.type == null)
attachment.type = "application/octet-stream";