SimpleMobileTools / Simple-File-Manager

Easy app for managing your files without ads, respecting your privacy & security
https://www.simplemobiletools.com
GNU General Public License v3.0
1.49k stars 379 forks source link

When opening a file with an unknown extension, the mime type is empty #689

Closed dvmc closed 1 year ago

dvmc commented 1 year ago

When opening a file with an unknown extension, the mime type is empty/null, and not e.g. application/octet-stream or */*, leaving me in my case just with Intercept the Intent. When I choose one of the aforementioned mime types there, more apps are presented. Might be related to #489. Here is the intercepted intent for extension .md:

intent://media/external/file/47861#Intent;scheme=content;type=;S.real_file_path_2=%2Fstorage%2Femulated%2F0%2FNotes%2FSrpska2023Daten.md;end 
------------ 
ACTION: android.intent.action.VIEW 
DATA: content://media/external/file/47861 
MIME: 
URI: intent://media/external/file/47861#Intent;scheme=content;type=;S.real_file_path_2=%2Fstorage%2Femulated%2F0%2FNotes%2FSrpska2023Daten.md;end 
FLAGS: 
none 
EXTRAS: 
1 Class: java.lang.String 
Key: real_file_path_2 
Value: /storage/emulated/0/Notes/Srpska2023Daten.md 

------------ 
MATCHING ACTIVITIES: 
none 
dvmc commented 1 year ago

It seems that when opening a file with OPEN_AS_DEFAULT, an empty mime type is submitted. I'm not too familiar with Android intents, but is this ever useful? My suggestion is deleting line 49 in Activity.kt, that way OPEN_AS_DEFAULT would yield the mime type */*. https://github.com/SimpleMobileTools/Simple-File-Manager/blob/67f519fb8988ac5e8f0f88d26c891fc40ee84828/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/extensions/Activity.kt#L48-L55

tibbi commented 1 year ago

just long press the given file and use Menu -> Open as

dvmc commented 1 year ago

Great! That would also be a workaround for issue billthefarmer/notes#44. (EDIT: Well, it worked just once.)

However, this does not work for shortcuts.