diff --git a/CHANGELOG.md b/CHANGELOG.md index f2944049b..c720140c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- Fixed unhiding a file whose name is only dots deleting it ([#517]) ## [1.6.3] - 2026-10-20 ### Changed @@ -145,6 +147,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#250]: https://github.com/FossifyOrg/File-Manager/issues/250 [#251]: https://github.com/FossifyOrg/File-Manager/issues/251 [#267]: https://github.com/FossifyOrg/File-Manager/issues/267 +[#517]: https://github.com/FossifyOrg/File-Manager/issues/517 [Unreleased]: https://github.com/FossifyOrg/File-Manager/compare/1.6.3...HEAD [1.6.3]: https://github.com/FossifyOrg/File-Manager/compare/1.6.2...1.6.3 diff --git a/app/src/main/kotlin/org/fossify/filemanager/extensions/Activity.kt b/app/src/main/kotlin/org/fossify/filemanager/extensions/Activity.kt index 82603c18f..8f8e9a1be 100644 --- a/app/src/main/kotlin/org/fossify/filemanager/extensions/Activity.kt +++ b/app/src/main/kotlin/org/fossify/filemanager/extensions/Activity.kt @@ -76,6 +76,13 @@ fun BaseSimpleActivity.toggleItemVisibility(oldPath: String, hide: Boolean, call filename.substring(1, filename.length) } + // Unhiding "..." or "." would produce ".." or ".", which name the parent folder or the + // current one, so the rename fails and the file is lost. Leave such names as they are. + if (filename.isEmpty() || filename == "." || filename == "..") { + callback?.invoke(oldPath) + return + } + val newPath = "$path/$filename" if (oldPath != newPath) { renameFile(oldPath, newPath, false) { success, useAndroid30Way ->