Skip to content

fix(telegram): support image files sent as documents - #18819

Closed
dashixiong-droid wants to merge 1 commit into
NousResearch:mainfrom
dashixiong-droid:fix/telegram-image-documents
Closed

fix(telegram): support image files sent as documents#18819
dashixiong-droid wants to merge 1 commit into
NousResearch:mainfrom
dashixiong-droid:fix/telegram-image-documents

Conversation

@dashixiong-droid

Copy link
Copy Markdown

Problem

When users send image files (PNG, JPG, WEBP, GIF) as Telegram documents (file attachments) rather than as photos, the gateway rejects them with "Unsupported document type" because the image extensions are not in SUPPORTED_DOCUMENT_TYPES.

Solution

Add image format detection in the elif msg.document: branch of _handle_media_message, routing .png/.jpg/.jpeg/.webp/.gif files through the existing cache_image_from_bytes pipeline — the same path used for native Telegram photos.

Testing

Verified by sending a PNG as a document attachment to the Hermes Telegram bot — the image is now cached and accessible for vision analysis.

Related

  • Telegram Bot API sends images as msg.photo (compressed) or msg.document (full quality). This fix handles the latter case.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/telegram Telegram bot adapter sweeper:implemented-on-main Sweeper: behavior already present on current main tool/vision Vision analysis and image generation type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants