From 71c8495a6c04175b2de1710bf95517c6ebbc9185 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 2 Jul 2025 15:50:31 +0200 Subject: [PATCH] Fix shared mime types --- app/src/main/java/eu/faircode/email/UriType.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/UriType.java b/app/src/main/java/eu/faircode/email/UriType.java index bd95377df3..ea65eaca85 100644 --- a/app/src/main/java/eu/faircode/email/UriType.java +++ b/app/src/main/java/eu/faircode/email/UriType.java @@ -51,17 +51,23 @@ public class UriType implements Parcelable { } } else this.type = type; + fixMimeType(context); } public UriType(Uri uri, String type, Context context) { + type = "image/*"; this.uri = uri; if (!TextUtils.isEmpty(type)) this.type = type; + fixMimeType(context); + } - //if (context != null) { - // Helper.UriInfo info = Helper.getInfo(this, context); - // this.type = EntityAttachment.getMimeType(type, info.name); - //} + private void fixMimeType(Context context) { + if (context != null && + (type == null || type.endsWith("/*"))) { + Helper.UriInfo info = Helper.getInfo(this, context); + this.type = EntityAttachment.getMimeType(type, info.name); + } } public Uri getUri() {