fix: App crashes on uploading an image containing "+" in its name

as we're dealing with local file URLs only here, we don't want to turn
the plus signs (`+`) into spaces (leads to failing to open the file,
emits an exception, crashes later on in our JS code)

Fixes #9538
This commit is contained in:
Lukáš Tinkl 2023-02-15 16:58:09 +01:00 committed by Lukáš Tinkl
parent 009861c7b4
commit 42445d4b73
2 changed files with 1 additions and 5 deletions

View File

@ -22,7 +22,7 @@ QtObject:
result.setup
proc formatImagePath*(self: Utils, imagePath: string): string =
result = uri.decodeUrl(replace(imagePath, "file://", ""))
result = uri.decodeUrl(replace(imagePath, "file://", ""), decodePlus=false)
if defined(windows):
# Windows doesn't work with paths starting with a slash
result.removePrefix('/')

View File

@ -1,10 +1,6 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import QtGraphicalEffects 1.0
import utils 1.0
import ".."
StatusChatImageValidator {
id: root