Skip to content

Escape Markdown in Telegram notification titles - #599

Merged
neSpecc merged 4 commits into
masterfrom
fix/telegram-markdown-escape
Nov 2, 2026
Merged

neSpecc merged 4 commits into
masterfrom
fix/telegram-markdown-escape

Conversation

@Kuchizu

@Kuchizu Kuchizu commented Oct 31, 2026

Copy link
Copy Markdown
Member

Titles with unbalanced _ * ` [ made Telegram reject the message (400 can't parse entities), so about 20% of notifications were lost.

neSpecc
neSpecc previously approved these changes Oct 31, 2026
neSpecc
neSpecc previously approved these changes Nov 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An unresolved moderate finding remains: the project name is inserted raw inside a Telegram bold entity in event.ts and several-events.ts, so names containing Markdown characters can still cause a 400 error.

1 open issue
What changed in this PR

This PR fixes lost Telegram notifications. Event titles containing unbalanced _, *, ` or [ made Telegram reject the message with a "can't parse entities" error. The fix adds an escapeMarkdown helper and applies it to titles in the single-event and several-events templates.

Changes:

  • Adds an escapeMarkdown helper in the Telegram event template and uses it for event titles.
  • Applies the same escaping to titles in the several-events template.
  • Adds a unit test for escaping.
  • Changes three fixed dates in the paymaster tests. This is not related to the PR's purpose.
File Description
workers/​telegram/​tests/​provider.test.ts Adds a test that checks escapeMarkdown output for _, *, ` and [.
workers/​telegram/​src/​templates/​several-events.ts Escapes each event title before it is added to the grouped message.
workers/​telegram/​src/​templates/​event.ts Adds the escapeMarkdown helper and applies it to the event title.
workers/​paymaster/​tests/​index.test.ts Changes three test dates to a fixed value. This change is unrelated to the Telegram fix.

Review effort: Lite

Comment thread workers/telegram/src/templates/event.ts Resolved
@neSpecc
neSpecc merged commit 205019f into master Nov 2, 2026
5 checks passed
@neSpecc
neSpecc deleted the fix/telegram-markdown-escape branch November 2, 2026 20:56
Kuchizu added a commit that referenced this pull request Nov 2, 2026
* fix(javascript): keep backtrace coordinates when source map lookup misses (#601)

source-map-js returns nulls for an unmapped position, and writing them onto the frame dropped the catcher location.

* Escape Markdown in Telegram notification titles (#599)

* Escape Markdown in Telegram notification titles

* Pin current date in paymaster tests to avoid month overflow

* Escape project name in Telegram notification footer

---------

Co-authored-by: Peter <specc.dev@gmail.com>

---------

Co-authored-by: Peter <specc.dev@gmail.com>
Co-authored-by: Kuchizu <70284260+Kuchizu@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants