Fixed AttachmentProvider.getType()

This commit is contained in:
str4d
2015-01-01 11:02:16 +00:00
parent 94f0561854
commit 9626e5e384

View File

@@ -98,8 +98,14 @@ public class AttachmentProvider extends ContentProvider {
if (sUriMatcher.match(uri) != UriMatcher.NO_MATCH) {
try {
Part attachment = getAttachment(uri);
if (attachment != null)
return attachment.getContentType();
if (attachment != null) {
String contentType = attachment.getContentType();
// Remove any "; name=fileName" suffix
int delim = contentType.indexOf(';');
if (delim >= 0)
contentType = contentType.substring(0, delim);
return contentType;
}
} catch (PasswordException e) {
e.printStackTrace();
} catch (IOException e) {