Skip to content

Commit d1feab0

Browse files
authored
fix(adapters): bump telegramify-markdown to 1.3.3 for blockquote escaping (#1340)
* fix(adapters): bump telegramify-markdown to 1.3.3 for blockquote escaping telegramify-markdown 1.3.2 escapes the `>` blockquote marker (which Telegram MarkdownV2 supports natively) and double-escapes any other special character on the same line, so any blockquote ending in a period (or containing `.`, `!`, `-`, etc.) is rejected by the Bot API with "Character '.' is reserved and must be escaped". The bot falls back to plain text and logs telegram.markdownv2_failed. Upstream fixed both bugs in 1.3.3. Bumping the floor to ^1.3.3 and adding a regression test on the canonical "> hi." case so the behaviour can't silently regress if the dependency loosens later. Fixes #1102 * test(adapters): broaden blockquote regression with multi-char and multi-line cases Addresses review nit on #1340. 1.3.2's bug regressed both on multiple special characters on one line and on multi-line blockquotes, so pinning those shapes down adds real confidence against a future re-regression. Expected outputs verified against telegramify-markdown 1.3.3: - `> a.b-c!` escapes `.`, `-`, `!` exactly once, `>` marker unescaped. - `> first.\n> second?` escapes `.` once, `?` passes through (not in Telegram MarkdownV2's reserved set), `>` marker unescaped on both lines. * test(adapters): reframe blockquote regression comment around bug behavior Address review on #1340: drop version-number framing in favor of describing the bug behavior. Version numbers rot as the floor moves; the bug behavior plus the issue link stays stable.
1 parent a7f8ae1 commit d1feab0

3 files changed

Lines changed: 21 additions & 3 deletions

File tree

bun.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/adapters/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"@slack/bolt": "^4.6.0",
2424
"discord.js": "^14.16.0",
2525
"grammy": "^1.36.0",
26-
"telegramify-markdown": "^1.3.0"
26+
"telegramify-markdown": "^1.3.3"
2727
},
2828
"peerDependencies": {
2929
"typescript": "^5.0.0"

packages/adapters/src/chat/telegram/markdown.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,24 @@ describe('telegram-markdown', () => {
6767
});
6868
});
6969

70+
describe('blockquotes', () => {
71+
// Regression: telegramify-markdown escaped the `>` blockquote marker
72+
// and double-escaped special characters on the same line, which
73+
// Telegram rejected with "Character '.' is reserved and must be
74+
// escaped". See coleam00/Archon#1102.
75+
test('escapes special chars exactly once inside blockquotes', () => {
76+
expect(convertToTelegramMarkdown('> hi.')).toBe('> hi\\.\n');
77+
});
78+
79+
test('escapes multiple special chars exactly once on the same blockquote line', () => {
80+
expect(convertToTelegramMarkdown('> a.b-c!')).toBe('> a\\.b\\-c\\!\n');
81+
});
82+
83+
test('preserves the `>` marker on every line of a multi-line blockquote', () => {
84+
expect(convertToTelegramMarkdown('> first.\n> second?')).toBe('> first\\.\n> second?\n');
85+
});
86+
});
87+
7088
describe('edge cases', () => {
7189
test('handles empty string', () => {
7290
const result = convertToTelegramMarkdown('');

0 commit comments

Comments
 (0)