Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Potential fix for code scanning alert no. 83: Incomplete string escaping or encoding

Andrii Romasiun501dc0a5641e
diff --git a/backend/apps/cloud/src/integrations/telegram/telegram.service.ts b/backend/apps/cloud/src/integrations/telegram/telegram.service.ts
index 45282e208..52caac867 100644
--- a/backend/apps/cloud/src/integrations/telegram/telegram.service.ts
+++ b/backend/apps/cloud/src/integrations/telegram/telegram.service.ts
@@ -115,8 +115,8 @@ export class TelegramService {
escapeTelegramMarkdown(text?: string | null) {
if (text === null || text === undefined) return ''
- // Characters to escape for legacy Markdown: _, *, `, [
- const charsToEscapeRegex = /[_*`[]/g
+ // Characters to escape for legacy Markdown: _, *, `, [, \
+ const charsToEscapeRegex = /[_*`[\]\\]/g
return text.replace(charsToEscapeRegex, '\\$&')
}