Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix missing .json file extension when exporting notes
The input from the user doesn't have a .json suffix. Previously, we passed that value to ActivityResultContracts.CreateDocument as is (without an extension), and relied on the file picker to automatically append the extension based on the MIME type. But some file pickers don't automatically append the extension, e.g. the native Files app (com.android.documentsui) on Android <= 9, and FossifyOrg/File-Manager. This results in the exported file not having a .json extension. Fix this by manually appending the .json extension before passing the file name to CreateDocument. Manually appending the extension shouldn't cause a problem for file pickers that can automatically add an extension. For example the native Files app doesn't add a second extension, and if the file already exists it generates a unique name correctly, with the "(1)" inserted before the extension, e.g. "Notes (1).json". Fixes #13.
- Loading branch information