From 665e1ea3d3aca0ea6e0f5fc49bc00c27b14f0e6f Mon Sep 17 00:00:00 2001 From: ibrahim-iqbal Date: Tue, 3 Nov 2026 19:05:36 +0530 Subject: [PATCH] fix: keep files whose names are only dots when unhiding (#517) Unhiding "..." produced the name "..", which names the parent folder, so the rename failed and the file and its content were lost. Leave such names as they are, the same way a name that is already visible is skipped. --- CHANGELOG.md | 3 +++ .../kotlin/org/fossify/filemanager/extensions/Activity.kt | 7 +++++++ 2 files changed, 10 insertions(+) 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 ->