fix(telegram): improve MarkdownV2 edit fallback and fix _strip_mdv2 bold handling

When edit_message(finalize=True) fails with a MarkdownV2 parse error,
the silent fallback previously sent raw content with escape sequences.
Now it logs the error and strips markdown formatting via _strip_mdv2()
for clean plain-text fallback.

Also fixes _strip_mdv2 to handle standard markdown bold (\*\*text\*\*)
before MarkdownV2 bold (\*text\*), preventing half-stripped asterisks.

Refs: #41955, #41732
This commit is contained in:
ruangraung
2026-06-08 15:53:16 -07:00
committed by Teknium
parent 6d2732e786
commit f4531feee8
2 changed files with 11 additions and 3 deletions
+1 -1
View File
@@ -835,7 +835,7 @@ class TestEditMessageStreamingSafety:
assert second_call == {
"chat_id": 123,
"message_id": 456,
"text": "final **bold**",
"text": "final bold",
}
@pytest.mark.asyncio