fix(community-service): fix community image parsing for windows

Fixes #9678
This commit is contained in:
Jonathan Rainville 2023-03-01 16:39:41 -05:00
parent ef99e3d017
commit 7db4a5ca52
1 changed files with 8 additions and 5 deletions

View File

@ -883,7 +883,8 @@ QtObject:
bannerJsonStr: string, bannerJsonStr: string,
encrypted: bool) = encrypted: bool) =
try: try:
var image = singletonInstance.utils.formatImagePath(imageUrl) var bannerJson = bannerJsonStr.parseJson
bannerJson{"imagePath"} = newJString(singletonInstance.utils.formatImagePath(bannerJson["imagePath"].getStr))
var tagsString = tags var tagsString = tags
if len(tagsString) == 0: if len(tagsString) == 0:
tagsString = "[]" tagsString = "[]"
@ -896,11 +897,11 @@ QtObject:
access, access,
color, color,
tagsString, tagsString,
image, singletonInstance.utils.formatImagePath(imageUrl),
aX, aY, bX, bY, aX, aY, bX, bY,
historyArchiveSupportEnabled, historyArchiveSupportEnabled,
pinMessageAllMembersEnabled, pinMessageAllMembersEnabled,
bannerJsonStr, $bannerJson,
encrypted) encrypted)
if response.error != nil: if response.error != nil:
@ -943,6 +944,8 @@ QtObject:
let logoJson = parseJson(logoJsonStr) let logoJson = parseJson(logoJsonStr)
let cropRectJson = logoJson["cropRect"] let cropRectJson = logoJson["cropRect"]
var tagsString = tags var tagsString = tags
var bannerJson = bannerJsonStr.parseJson
bannerJson{"imagePath"} = newJString(singletonInstance.utils.formatImagePath(bannerJson["imagePath"].getStr))
if len(tagsString) == 0: if len(tagsString) == 0:
tagsString = "[]" tagsString = "[]"
let response = status_go.editCommunity( let response = status_go.editCommunity(
@ -954,12 +957,12 @@ QtObject:
access, access,
color, color,
tagsString, tagsString,
logoJson["imagePath"].getStr(), singletonInstance.utils.formatImagePath(logoJson["imagePath"].getStr()),
int(cropRectJson["x"].getFloat()), int(cropRectJson["x"].getFloat()),
int(cropRectJson["y"].getFloat()), int(cropRectJson["y"].getFloat()),
int(cropRectJson["x"].getFloat() + cropRectJson["width"].getFloat()), int(cropRectJson["x"].getFloat() + cropRectJson["width"].getFloat()),
int(cropRectJson["y"].getFloat() + cropRectJson["height"].getFloat()), int(cropRectJson["y"].getFloat() + cropRectJson["height"].getFloat()),
bannerJsonStr, $bannerJson,
historyArchiveSupportEnabled, historyArchiveSupportEnabled,
pinMessageAllMembersEnabled) pinMessageAllMembersEnabled)