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
This commit is contained in:
Narasimha-sc
2026-04-21 18:07:58 +00:00
committed by GitHub
parent 607124079f
commit 0e1c3fac5c

View File

@@ -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 {