From 8be47db155e182bc185cd0d1340f31ccd495ac89 Mon Sep 17 00:00:00 2001 From: Lucas Gabriel Date: Tue, 15 Oct 2024 11:42:34 -0300 Subject: [PATCH] Fix code scanning alert no. 5: Incomplete string escaping or encoding Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- commands/quotes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/quotes.js b/commands/quotes.js index a634537..16c49f9 100644 --- a/commands/quotes.js +++ b/commands/quotes.js @@ -10,8 +10,8 @@ module.exports = (bot) => { try { const response = await axios.get('https://quotes-api-self.vercel.app/quote'); const data = response.data; - const escapedQuote = data.quote.replace(/([_*~`>.!-])/g, '\\$1'); - const escapedAuthor = `- ${data.author}.`.replace(/([_*~`>.!-])/g, '\\$1'); + const escapedQuote = data.quote.replace(/([\\_*~`>.!-])/g, '\\$1'); + const escapedAuthor = `- ${data.author}.`.replace(/([\\_*~`>.!-])/g, '\\$1'); const escapedData = `${Strings.quoteResult}\n>*${escapedQuote}*\n_${escapedAuthor}_`; ctx.reply(escapedData, {