Normalize data/type

pull/168/head
M66B 5 years ago
parent d19c0c9e6d
commit 79d230514a

@ -227,7 +227,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
// Build intent
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri, type);
intent.setDataAndTypeAndNormalize(uri, type);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
if (!TextUtils.isEmpty(attachment.name))
intent.putExtra(Intent.EXTRA_TITLE, Helper.sanitizeFilename(attachment.name));

@ -115,7 +115,7 @@ public class AdapterImage extends RecyclerView.Adapter<AdapterImage.ViewHolder>
// Build intent
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri, attachment.type);
intent.setDataAndTypeAndNormalize(uri, attachment.type);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
if (!TextUtils.isEmpty(attachment.name))
intent.putExtra(Intent.EXTRA_TITLE, attachment.name);

@ -2417,7 +2417,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
Uri lookupUri = ContactsContract.Contacts.getLookupUri(contactId, lookupKey);
edit.setAction(Intent.ACTION_EDIT);
edit.setDataAndType(lookupUri, ContactsContract.Contacts.CONTENT_ITEM_TYPE);
edit.setDataAndTypeAndNormalize(lookupUri, ContactsContract.Contacts.CONTENT_ITEM_TYPE);
} else {
edit.setAction(Intent.ACTION_INSERT);
edit.setType(ContactsContract.Contacts.CONTENT_TYPE);

@ -154,6 +154,8 @@ public class EntityAttachment {
if (encryption != null)
return type;
// https://blogs.msdn.microsoft.com/vsofficedeveloper/2008/05/08/office-2007-file-format-mime-types-for-http-content-streaming-2/
String extension = Helper.getExtension(name);
if (extension == null)
return type;

Loading…
Cancel
Save