Skip to content

fix(telegram): fallback to document when photo dimensions exceed limits#19630

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-8c54fd4a
May 4, 2026
Merged

fix(telegram): fallback to document when photo dimensions exceed limits#19630
teknium1 merged 1 commit into
mainfrom
hermes/hermes-8c54fd4a

Conversation

@teknium1

@teknium1 teknium1 commented May 4, 2026

Copy link
Copy Markdown
Contributor

Salvage of #15728 onto current main.\n\n## Summary\nTelegram's send_photo API rejects images where width+height > 10000px with . Catch that error and automatically fall back to (no dimension limit, 50MB size cap).\n\n## Validation\nManual review; diff scope self-contained.\n\nOriginal PR: #15728

Telegram's send_photo has dimension limits (sum of width+height <= 10000px).
When sending large screenshots or tall images, the API returns
'Photo_invalid_dimensions' error.

Fix: Catch this specific error in send_image_file() and automatically
fallback to send_document() which has no dimension limits (only 50MB size).

This is similar to the existing 5MB URL fallback (commit 542faf2) but
handles local files with dimension issues instead of URL size issues.
@teknium1 teknium1 merged commit f6aa196 into main May 4, 2026
8 of 10 checks passed
@teknium1 teknium1 deleted the hermes/hermes-8c54fd4a branch May 4, 2026 09:33
@alt-glitch alt-glitch added type/bug Something isn't working platform/telegram Telegram bot adapter P2 Medium — degraded but workaround exists labels May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Medium — degraded but workaround exists platform/telegram Telegram bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants