fix: filter InputFile objects from params in multipart requests - #364
Merged
The0xArchitect merged 1 commit intoJul 27, 2026
Merged
Conversation
Fixes multipart upload issue where InputFile.fromBytes() was causing Telegram API to reject requests with Bad Request error. Root cause: - InputFile objects were being serialized as attach URL strings in form fields - This conflicted with the actual file bytes sent as multipart data - Telegram API rejected the duplicate/conflicting data for the same field Solution: - Filter InputFile objects from params BEFORE jsonEncode in _sendMultipartRequest() - Only the actual file bytes are sent as multipart data - InputFile objects are handled separately via payload.files Affected methods: - sendPhoto() - sendDocument() - sendAudio() - sendVideo() - sendMediaGroup() - All other methods using InputFile.fromBytes() Testing: - Verified sendPhoto() with file bytes passes - Verified sendDocument() with file bytes passes - Verified sendMediaGroup() with multiple files passes
Collaborator
|
Sorry for the delay, got caught up with a few other works. Thanks for the fix! Will push a new release soon! |
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.
Fixes multipart upload issue where InputFile.fromBytes() was causing Telegram API to reject requests with Bad Request error.
Root cause:
Solution:
Affected methods:
Testing: