cryptomator / cryptomator/android
App crashes when opening a large text file in the built-in editor
- Dominant language
- Kotlin
- Stars
- 1.2k
- Forks
- 216
- PR merge metrics
- No merged PRs in 30d
Description
### Please agree to the following
- [x] I have searched [existing issues](https://github.com/cryptomator/android/issues?q=) for duplicates
- [x] I agree to follow this project's [Code of Conduct](https://github.com/cryptomator/android/blob/develop/.github/CODE_OF_CONDUCT.md)
### Summary
Opening a large (~15 MB) `.txt` file in the built-in text editor kills the app process. All vaults are locked afterwards and the password has to be entered again.
### System Setup
```markdown
- Android: not specified by the reporter
- Cryptomator: 2.0.0
```
### Steps to Reproduce
1. Unlock a vault
2. Open a `.txt` file of roughly 15 MB stored in it
3. Tapping the file routes it to the built-in text editor
### Expected Behavior
The file opens, or the app reports that it is too large for the built-in editor and offers to open it with another app.
### Actual Behavior
The app terminates and restarts. Because the process dies, all vaults are locked and the password must be entered again. No error message is shown.
### Reproducibility
Always
### Relevant Log Output
```shell
(no debug log supplied yet)
```
### Anything else?
Files ending in `.txt`, `.md` and `.todo` are always routed to the built-in editor in `BrowseFilesPresenter.viewFile()`, with no size check and no way to opt out. `TextEditorPresenter.loadFileContent()` reads the whole file into a single `String` via `FileCacheUtils.read()` and hands it to the `EditText`, so memory use scales with file size — and again on save via `binding.textEditor.text.toString()`. This is consistent with an `OutOfMemoryError` on a file of this size.
Possibly related: #588 (text editor performance on large files).
### Additional Context
Reported via support ticket. Awaiting developer confirmation.
Contributor guide
Assessment
This issue has not been assessed yet.