desktop: do not suggest file names starting with "<" (#8103)

This commit is contained in:
Evgeny @ SimpleX Chat authored and GitHub committed 2026-11-10 07:15:11 +00:00
1 parent 3ff3a124e4
commit 3320b21b1d
2 files changed
+3 -2

No files matched your search

@@ -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()
@@ -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("<notes.txt"))
}
@Test