diff --git a/src/com/android/email/activity/MessageCompose.java b/src/com/android/email/activity/MessageCompose.java index fcb9142fc..0d57be7b2 100644 --- a/src/com/android/email/activity/MessageCompose.java +++ b/src/com/android/email/activity/MessageCompose.java @@ -848,15 +848,8 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc private void addAttachment(Uri uri, int size, String name) { ContentResolver contentResolver = getContentResolver(); - String contentType = contentResolver.getType(uri); - - if (contentType == null) { - contentType = ""; - } - Attachment attachment = new Attachment(); attachment.name = name; - attachment.contentType = contentType; attachment.size = size; attachment.uri = uri; @@ -882,6 +875,30 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc attachment.name = uri.getLastPathSegment(); } + String contentType = contentResolver.getType(uri); + + if (contentType == null) { + boolean found = false; + if (attachment.name!=null) { + int index = attachment.name.lastIndexOf('.'); + if (index!=-1) { + String extension = attachment.name.substring(index+1).toLowerCase(); + for (int i=0; i