diff --git a/CHANGELOG.md b/CHANGELOG.md
index fd08943f9..c40d56f0a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
- Fixed the modification of the original timestamp when decompressing folders ([#190])
+- Fixed a crash when opening very large text files in the built-in editor by adding a 1 MB size limit ([#123])
## [1.6.1] - 2026-02-14
### Changed
@@ -125,6 +126,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#105]: https://github.com/FossifyOrg/File-Manager/issues/105
[#106]: https://github.com/FossifyOrg/File-Manager/issues/106
[#120]: https://github.com/FossifyOrg/File-Manager/issues/120
+[#123]: https://github.com/FossifyOrg/File-Manager/issues/123
[#131]: https://github.com/FossifyOrg/File-Manager/issues/131
[#136]: https://github.com/FossifyOrg/File-Manager/issues/136
[#149]: https://github.com/FossifyOrg/File-Manager/issues/149
diff --git a/app/src/main/kotlin/org/fossify/filemanager/activities/ReadTextActivity.kt b/app/src/main/kotlin/org/fossify/filemanager/activities/ReadTextActivity.kt
index 9696e0650..0600f07b1 100644
--- a/app/src/main/kotlin/org/fossify/filemanager/activities/ReadTextActivity.kt
+++ b/app/src/main/kotlin/org/fossify/filemanager/activities/ReadTextActivity.kt
@@ -34,6 +34,7 @@ class ReadTextActivity : SimpleActivity() {
private const val SELECT_SAVE_FILE_INTENT = 1
private const val SELECT_SAVE_FILE_AND_EXIT_INTENT = 2
private const val KEY_UNSAVED_TEXT = "KEY_UNSAVED_TEXT"
+ private const val FILE_SIZE_LIMIT = 1000 * 1000 // 1 MB, same limit as Fossify Notes
}
private val binding by viewBinding(ActivityReadTextBinding::inflate)
@@ -285,6 +286,18 @@ class ReadTextActivity : SimpleActivity() {
}
private fun checkIntent(uri: Uri, savedInstanceState: Bundle?) {
+ val fileSize = if (uri.scheme == "file") {
+ File(uri.path!!).length()
+ } else {
+ getSizeFromContentUri(uri)
+ }
+
+ if (fileSize > FILE_SIZE_LIMIT) {
+ toast(R.string.file_too_large)
+ finish()
+ return
+ }
+
originalText = if (uri.scheme == "file") {
filePath = uri.path!!
val file = File(filePath)
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 07a68b549..009fe67a5 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -40,6 +40,7 @@
File Editor
+ File too large, the limit is 1MB
Storage analysis