mirror of
https://github.com/M66B/FairEmail.git
synced 2026-05-19 13:34:00 +02:00
Normalize data/type
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user