fix(telegram): fallback to document when photo dimensions exceed limits#19630
Merged
Conversation
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.
This was referenced May 4, 2026
10 tasks
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.
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