fix(telegram): support image files sent as documents#18819
Closed
dashixiong-droid wants to merge 1 commit into
Closed
fix(telegram): support image files sent as documents#18819dashixiong-droid wants to merge 1 commit into
dashixiong-droid wants to merge 1 commit into
Conversation
When users send image files (PNG/JPG/WEBP/GIF) as Telegram documents rather than photos, the gateway rejected them with 'Unsupported document type'. This patch adds image format detection in the document handler, routing them through the existing image cache for vision tool access.
Collaborator
|
Likely duplicate of #16710 — same fix routing image documents through cache_image_from_bytes pipeline in Telegram gateway. |
1 similar comment
Collaborator
|
Likely duplicate of #16710 — same fix routing image documents through cache_image_from_bytes pipeline in Telegram gateway. |
This was referenced May 3, 2026
Contributor
|
This is already implemented on current Automated hermes-sweeper review evidence:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/.giffiles through the existingcache_image_from_bytespipeline — 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
msg.photo(compressed) ormsg.document(full quality). This fix handles the latter case.