From 0e1c3fac5c0df206e7746fd7e15bcd9d60a1ace0 Mon Sep 17 00:00:00 2001 From: Narasimha-sc <166327228+Narasimha-sc@users.noreply.github.com> Date: Tue, 21 Apr 2026 18:07:58 +0000 Subject: [PATCH] desktop: fix sending files with + in file name (#6836) * desktop: fix sending files with + in file name Use RFC 3986 URI encoding (File.toURI()) instead of application/x-www-form-urlencoded (URLEncoder/URLDecoder) for file path URIs. URLDecoder treated literal + as space, corrupting filenames containing + on desktop. * less breaking approach --- .../commonMain/kotlin/chat/simplex/common/platform/Files.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/platform/Files.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/platform/Files.kt index 88d9fbb705..cdd4140e3f 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/platform/Files.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/platform/Files.kt @@ -42,7 +42,9 @@ expect fun desktopOpenDir(dir: File) fun createURIFromPath(absolutePath: String): URI = URI.create(URLEncoder.encode(absolutePath, "UTF-8")) -fun URI.toFile(): File = File(URLDecoder.decode(rawPath, "UTF-8").removePrefix("file:")) +fun URI.toFile(): File = + if (scheme == "file") File(this) + else File(URLDecoder.decode(rawPath, "UTF-8").removePrefix("file:")) fun copyFileToFile(from: File, to: URI, finally: () -> Unit) { try {