pagermon icon indicating copy to clipboard operation
pagermon copied to clipboard

Telegram notifications break if message has odd number of certain characters

Open drsn0w opened this issue 1 year ago • 1 comments

Describe the bug Telegram notifications break if message has an odd number of "_" (underscore)s. Messages are sent with parse_mode: markdown and the Telegram Bot API attempts to interpret these unescaped underscores as Markdown italics, but fails when it finds an odd number. Produces error error : Telegram: StatusCodeError: 400 - {"ok":false,"error_code":400,"description":"Bad Request: can't parse entities: Can't find end of the entity starting at byte offset ...

To Reproduce Steps to reproduce the behavior:

  1. Receive page with odd number of underscores with Telegram notifications enabled.
  2. Telegram bot API returns error due to not being able to parse the Markdown it expects.

Additional context This could be solved by escaping Markdown special characters in the message before sending to Telegram API

drsn0w avatar Jul 15 '24 07:07 drsn0w

I wrote a fix that hopefully works. I don't run a telegram bot myself, so I'm needing someone to test it for me. 200w

eopo avatar Jul 16 '24 20:07 eopo

Will be fixed with next release

eopo avatar Apr 24 '25 09:04 eopo