fix(fileprovider): add external-path for Download/Kizzy to prevent crash#456
fix(fileprovider): add external-path for Download/Kizzy to prevent crash#456dead8309 merged 1 commit intodead8309:masterfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a crash occurring on Android 13+ when exporting custom RPC configuration files to the Download/Kizzy/ directory. The crash was caused by FileProvider not being configured to expose external download paths, resulting in an IllegalArgumentException when attempting to generate content URIs for these files.
Key Changes:
- Added
external-pathconfiguration toprovider_paths.xmlto allow sharing files from theDownload/directory and its subdirectories
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| name="files" | ||
| path="." /> | ||
|
|
||
| <external-path |
There was a problem hiding this comment.
The external-path element exposes the entire Download/ directory and all its subdirectories to other apps through FileProvider. This creates a broad security surface since any file placed in Download/ can now be shared via content URIs. Consider using external-files-path with getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS) instead, which provides app-specific external storage that doesn't require broad access permissions and is automatically cleaned up when the app is uninstalled.
| <external-path | |
| <external-files-path |
There was a problem hiding this comment.
About Copilot’s suggestion to use
<external-files-path>
This app intentionally uses <external-path path="Download/" /> because the exported files (custom RPC configs) are meant to be directly accessible by the user in the public Download/Kizzy/ directory.
The main goal of this feature is to let users easily locate, edit, or share their exported configuration without needing developer tools or special file access.
Using <external-files-path> would place the file inside /Android/data/<package>/files/Download/, which is not visible to most file managers on Android 11+ due to scoped storage restrictions.
That would make the “Export Config” feature confusing and effectively unusable for end users.
The chosen implementation limits access to the Download/ directory only (and its subdirectories), which is acceptable for user-generated exports and does not expose sensitive app data.
In short, this is a deliberate design choice prioritizing user accessibility over isolation, within a controlled and predictable export path.
|
we don't have any plans to publish the app on playstore as of now, so I'm merging this. You can skip the copilot review |
Fix FileProvider crash when exporting custom RPC config
Summary
This PR fixes a crash that occurs on Android 13 and above when exporting a custom RPC configuration file located under
Download/Kizzy/.FileProviderwas not configured to expose externalDownload/paths, leading to anIllegalArgumentExceptionwhen generating acontent://URI.Root cause
Starting from Android 13, scoped storage enforcement became stricter.
FileProvideronly allows sharing files from roots explicitly declared inres/xml/provider_paths.xml.Since
/storage/emulated/0/Download/Kizzy/<name>.jsonwas outside the configured roots (which only includedfiles-path), the system threw:Changes
<external-path name="downloads" path="Download/" />tores/xml/provider_paths.xmlto allow sharing files fromDownload/and its subdirectories (includingDownload/Kizzy/).provider_paths.xml (updated)