Skip to content

Commit 4040ad7

Browse files
authored
Added support for string-content attachments & fixed HTTParty encoding issues. (#530)
* fix(http-client): replace Tempfile with StringIO for multipart uploads - 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 * fix(http-client): resolve HTTParty encoding compatibility issue with 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 * Fix UTF-8 encoding issue with binary attachment content in JSON serialization - 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
1 parent c35e81e commit 4040ad7

File tree

8 files changed

+893
-89
lines changed

8 files changed

+893
-89
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
**/*/.env
33
# Example test files
44
examples/messages/large_test_file.txt
5+
examples/messages/small_pdf_test_file.pdf
6+
examples/messages/large_pdf_test_file.pdf
7+
examples/messages/large_jpg_test_file.jpg
58
*.gem
69
*.rbc
710
.bundle

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
### [Unreleased]
44
* Added support for `single_level` query parameter in Folders API for Microsoft accounts
55
* Added support for `include_hidden_folders` query parameter in folders list endpoint for Microsoft accounts to control whether hidden folders are included in the response
6+
* Added support for passing in string contents for multipart and base64 (<3MB) attachments (#528)
7+
* Fixed HTTParty encoding compatibility issue with multipart requests (#528)
68

79
### 6.5.0 / 2025-06-13
810
* Replaced `rest-client` dependency with `httparty` for improved maintainability and security

0 commit comments

Comments
 (0)