fix(@desktop/chat): fix upload of image with special characters

fixes #3034
This commit is contained in:
Anthony Laibe 2021-07-23 11:10:22 +02:00 committed by Iuri Matias
parent 0bc7a6038b
commit 5488abcbde
1 changed files with 2 additions and 1 deletions

View File

@ -1,7 +1,8 @@
import strutils import strutils
import uri as uri
proc formatImagePath*(imagePath: string): string = proc formatImagePath*(imagePath: string): string =
result = replace(imagePath, "file://", "") result = uri.decodeUrl(replace(imagePath, "file://", ""))
if defined(windows): if defined(windows):
# Windows doesn't work with paths starting with a slash # Windows doesn't work with paths starting with a slash
result.removePrefix('/') result.removePrefix('/')