fix: guard markdownToHtml in the HTML fallback path
A throw from the converter used to escape the try/catch and drop the message; degrade to plain text for that chunk instead.
This commit is contained in:
+6
-1
@@ -954,7 +954,12 @@ export class TelegramBridge {
|
||||
private async deliverHtml(chatId: number, markdown: string): Promise<void> {
|
||||
const chunks = splitMessage(markdown, this.maxMessageLength)
|
||||
for (const chunk of chunks) {
|
||||
const html = markdownToHtml(chunk)
|
||||
let html: string
|
||||
try {
|
||||
html = markdownToHtml(chunk)
|
||||
} catch {
|
||||
html = chunk // Pathological markdown input: degrade to plain text instead of dropping.
|
||||
}
|
||||
try {
|
||||
await this.withRetry(() => this.client.sendMessage(chatId, html, 'HTML'))
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user