From 67bbacb3b79f603d5b662e1b0b080ce212ac96a2 Mon Sep 17 00:00:00 2001 From: nullrunner Date: Thu, 29 Jan 2026 23:45:40 +0100 Subject: [PATCH] fix(media): skip audio files in extractFileBlocks text extraction Audio files (especially OGG/Opus from Telegram voice messages) were being misidentified as text by looksLikeUtf8Text() because OGG headers contain >85% printable ASCII. This caused guessDelimitedMime() to classify them as text/tab-separated-values, injecting raw binary into the model context. Add audio to the skip list alongside image and video in extractFileBlocks() so audio attachments are routed to the transcription pipeline instead of being treated as text files. Fixes #1989 --- src/media-understanding/apply.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/media-understanding/apply.ts b/src/media-understanding/apply.ts index 7c2a18006..1bb041cc6 100644 --- a/src/media-understanding/apply.ts +++ b/src/media-understanding/apply.ts @@ -216,7 +216,7 @@ async function extractFileBlocks(params: { } const forcedTextMime = resolveTextMimeFromName(attachment.path ?? attachment.url ?? ""); const kind = forcedTextMime ? "document" : resolveAttachmentKind(attachment); - if (!forcedTextMime && (kind === "image" || kind === "video")) { + if (!forcedTextMime && (kind === "image" || kind === "audio" || kind === "video")) { continue; } if (!limits.allowUrl && attachment.url && !attachment.path) {