diff --git a/app/src/main/java/com/termux/app/TermuxOpenReceiver.java b/app/src/main/java/com/termux/app/TermuxOpenReceiver.java index f8f21b5d32..f27f922cab 100644 --- a/app/src/main/java/com/termux/app/TermuxOpenReceiver.java +++ b/app/src/main/java/com/termux/app/TermuxOpenReceiver.java @@ -172,6 +172,13 @@ public Cursor query(@NonNull Uri uri, String[] projection, String selection, Str @Override public String getType(@NonNull Uri uri) { + String path = uri.getLastPathSegment(); + int extIndex = path.lastIndexOf('.') + 1; + if (extIndex > 0) { + MimeTypeMap mimeMap = MimeTypeMap.getSingleton(); + String ext = path.substring(extIndex).toLowerCase(); + return mimeMap.getMimeTypeFromExtension(ext); + } return null; }