mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-04-25 14:12:27 +00:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user