Commit 19f0a2a
fix: resolve proper filename when saving a shared file (#86)
* Fix filename when saving a shared file
Previously, the code used the last path component of the content URI,
but that isn't necessarily the filename -- it can be a numeric ID.
Switch to the helper function getFilenameFromContentUri(), which uses
ContentResolver to read the DISPLAY_NAME column. (If that fails, we
fall back to the last component of the content URI as before, because
we don't have anything better to use.)
Also improve the way the MIME type is determined. Previously it was
just based on the file extension. Switch to first query the
ContentResolver, then try the type of the Intent (which is supposed to
be set to the MIME type of the data for ACTION_SEND, but may be set to
"*/*" if the type is unknown), and only then fall back to using the
file extension.
Fixes #37.
* style: shorten lines
---------
Co-authored-by: Naveen Singh <[email protected]>
Co-authored-by: Naveen Singh <[email protected]>1 parent 97dcf30 commit 19f0a2a
File tree
1 file changed
+6
-3
lines changed- app/src/main/kotlin/org/fossify/filemanager/activities
1 file changed
+6
-3
lines changedLines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
40 | 44 | | |
41 | | - | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| |||
0 commit comments