From 3320b21b1db7b35933ebdef290b59991c0d2b25b Mon Sep 17 00:00:00 2001 From: "Evgeny @ SimpleX Chat" <259188159+evgeny-simplex@users.noreply.github.com> Date: Tue, 10 Nov 2026 07:15:11 +0000 Subject: [PATCH] desktop: do not suggest file names starting with "<" (#8103) --- .../kotlin/chat/simplex/common/platform/Files.desktop.kt | 2 +- .../kotlin/chat/simplex/app/SaveDialogFileNameTest.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/platform/Files.desktop.kt b/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/platform/Files.desktop.kt index 9720a78435..970876c7d3 100644 --- a/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/platform/Files.desktop.kt +++ b/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/platform/Files.desktop.kt @@ -116,7 +116,7 @@ private fun fileFilterDescription(input: String): String = when(input) { else -> "" } -internal fun saveDialogFileName(name: String): String = name.trimStart('.').ifEmpty { name } +internal fun saveDialogFileName(name: String): String = name.trimStart('.', '<').ifEmpty { name } actual fun URI.inputStream(): InputStream? = toFile().inputStream() actual fun URI.outputStream(): OutputStream = toFile().outputStream() diff --git a/apps/multiplatform/common/src/desktopTest/kotlin/chat/simplex/app/SaveDialogFileNameTest.kt b/apps/multiplatform/common/src/desktopTest/kotlin/chat/simplex/app/SaveDialogFileNameTest.kt index 21b3d2e341..6d903a0b4b 100644 --- a/apps/multiplatform/common/src/desktopTest/kotlin/chat/simplex/app/SaveDialogFileNameTest.kt +++ b/apps/multiplatform/common/src/desktopTest/kotlin/chat/simplex/app/SaveDialogFileNameTest.kt @@ -6,9 +6,10 @@ import kotlin.test.assertEquals class SaveDialogFileNameTest { @Test - fun testLeadingDotsRemoved() { + fun testLeadingDotsAndLessThanSignsRemoved() { assertEquals("bashrc", saveDialogFileName(".bashrc")) assertEquals("hidden.txt", saveDialogFileName("..hidden.txt")) + assertEquals("notes.txt", saveDialogFileName("