Open luewolf opened 10 months ago
Hi devs, would you like help with this?
It seems reasonably straightforward -- modify SaveAsActivity.kt to call contentResolver.query(source, ...)
and look up the relevant columns (I think MediaStore.MediaColumns.DISPLAY_NAME
, and fall back to DATA
; also MIME_TYPE
). I'm happy to write a PR.
I'm happy to write a PR.
@tom93 When there's no needs triage
label on an issue, you're free to create a PR solving it.
@tom93 Are you still planning to make a PR?
@matkoniecz I've been putting it off, but your message gave me the push I needed and I finally made PR #86 :)
For people who want to test my fix without building from source, I've built an APK with the patch from my PR plus this patch which adds some debugging logs, but note that I am not a project member so you shouldn't trust me:
unofficial-file-manager-pr-86-with-debug.apk.zip
To view the debug logs, run adb logcat
and search for lines containing "XXX".
In the end I didn't implement the fallback to the DATA column, because the DISPLAY_NAME column worked in all my tests (and there was existing code for reading the DISPLAY_NAME column).
Checklist
Describe the bug
When sharing a single file that isn't a directory from any app, the file manager can be selected as destination to save the file in shared storage. However, both the file name and extension are lost when saving the file. The loss of the file extension in particular means that other programs (i.e. those that only have permissions for media files) won't be able to discover/open the file.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Ideally, the file would keep its name and extension.
If the sharing API simply does not provide this info, file extensions can be "guessed" using a file format's magic number. This should be implemented for common file formats like zip, pdf, png, jpg, webp, gif, mp3, mp4, ogg.