From a12c0a8211d070bec3930f57e02cc0ad6bf425bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Gro=C3=9F?= Date: Thu, 9 Mar 2023 12:20:28 +0100 Subject: [PATCH] Profile: (Amend) Fix replace/encode order of custom status Replacement happened before encoding, causing the entire status string to be encoded, including the SVG tags themselves. --- commands/profile.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commands/profile.js b/commands/profile.js index 5eed598..caee635 100644 --- a/commands/profile.js +++ b/commands/profile.js @@ -28,11 +28,12 @@ module.exports = { let profile = await user.getProfile(); - let customStatus = profile.customStatus.replace(/(.{0,40}[\s])/g, '$1'); + let customStatus = this.encodeStr(profile.customStatus); + customStatus = customStatus.replace(/(.{0,40}[\s])/g, '$1'); let profileTemplate = fs.readFileSync('/app/assets/profile/profile.svg').toString(); profileTemplate = profileTemplate.replace(/{{USERNAME}}/g, this.encodeStr(discordUser.username.substr(0,15)+(discordUser.username.length>15?'...':''))); - profileTemplate = profileTemplate.replace(/{{PROFILE_TEXT}}/g, this.encodeStr(customStatus) ); + profileTemplate = profileTemplate.replace(/{{PROFILE_TEXT}}/g, customStatus ); profileTemplate = profileTemplate.replace(/{{HEADER_COLOR}}/g, '190,31,97'); profileTemplate = profileTemplate.replace(/{{CC}}/g, await Card.count({where: {userId: user.id}})); profileTemplate = profileTemplate.replace(/{{LVL}}/g, await user.level().currentLevel);