Fall back to document.thumb for videos sent as a Telegram document#407
Conversation
extractTelegramFileIds only read raw.video?.thumb, so videos sent as a Telegram "document" (to skip compression) never got a thumbnail — Telegram puts those under message.document, whose thumb was never checked. Minted tokens for document-uploaded videos ended up with no preview image as a result. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
extractTelegramFileIdsonly readraw.video?.thumb?.file_id; a video sent as a Telegram "document" (to skip compression) carries its file undermessage.documentinstead, and the client-generated thumbnail lands indocument.thumb— never checkedthumbFileIdwas alwaysundefinedfor document-uploaded videos, souploadVideoAttachment.tsnever fetched a thumb and the minted token metadata had noimagefield (no preview)raw.document?.thumb?.file_idwhenraw.video?.thumb?.file_idis absent;video.thumbstill takes priority when both are presentStacked on #406 (base branch is that PR's branch, not
main) since this branch was cut from its tip — diff here is just the 2 files for this fix.Test plan
pnpm vitest run src/lib/telegram/chat/attachment/__tests__/extractTelegramFileIds.test.ts— 10 tests passing, including new cases for document.thumb fallback and video.thumb precedencepnpm vitest run src/lib/telegram/chat— 251 tests passing🤖 Generated with Claude Code