Catch empty mime type and substitute application/octet-stream

b/14564897

Change-Id: Id91dd18ef8b3fab449eb178bde73303107b78590
This commit is contained in:
Tony Mantler 2014-05-05 13:25:51 -07:00
parent b5713fb731
commit aab514c942
1 changed files with 5 additions and 1 deletions

View File

@ -429,12 +429,16 @@ public class AttachmentUtilities {
MediaScannerConnection.scanFile(context, new String[] {absolutePath},
null, null);
final String mimeType = TextUtils.isEmpty(attachment.mMimeType) ?
"application/octet-stream" :
attachment.mMimeType;
try {
DownloadManager dm =
(DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
long id = dm.addCompletedDownload(attachment.mFileName, attachment.mFileName,
false /* do not use media scanner */,
attachment.mMimeType, absolutePath, size,
mimeType, absolutePath, size,
true /* show notification */);
contentUri = dm.getUriForDownloadedFile(id).toString();
} catch (final IllegalArgumentException e) {