Added support for string-content attachments & fixed HTTParty encoding issues.#530
Merged
Added support for string-content attachments & fixed HTTParty encoding issues.#530
Conversation
Pull Request SummaryThe pull request introduces several enhancements and fixes to improve file handling, error management, and multipart upload functionality in the Nylas Ruby SDK. Key changes include:
These changes aim to enhance the SDK's reliability, compatibility, and user experience when dealing with file uploads and multipart requests, particularly focusing on error management and internationalization support. Functional Tests
Files Changed
View more in PlayerZero |
- Replace Tempfile with StringIO in prepare_multipart_payload to eliminate filesystem dependencies - Add enhanced StringIO compatibility methods for HTTParty multipart handling - Update test expectations from Tempfile to StringIO - Add defensive file closing in messages.rb - Resolves issues with read-only containers and AWS Lambda environments Fixes #528
…multipart requests Fixes #528 - Resolves 'incompatible character encodings: ASCII-8BIT and UTF-8' error when sending multipart requests - Normalizes all multipart payload strings to consistent ASCII-8BIT encoding for HTTParty compatibility - Maintains backward compatibility while preventing encoding conflicts during multipart body generation - Updates test expectations to reflect new encoding behavior
…lization - Add normalize_json_encodings! method to handle binary attachment content - Automatically base64 encode binary strings before JSON serialization - Fixes 'source sequence is illegal/malformed utf-8' error when sending attachments with raw binary content via JSON (non-multipart) requests - Preserves backward compatibility with both symbol and string keys - Resolves issue #528
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.
Description
Reported in issue #528 - see a similar issue reported here jnunemaker/httparty#671
Fixes: Encoding::CompatibilityError when sending multipart requests with UTF-8 content
Closes: #528
https://nylas.atlassian.net/browse/TW-3983
License
I confirm that this contribution is made under the terms of the MIT license and that I have the authority necessary to make this contribution on behalf of its copyright owner.