Skip to content

Conversation

@AaronDDM
Copy link
Contributor

@AaronDDM AaronDDM commented Jun 2, 2025

Description

  • Replace unmaintained rest-client dependency with actively maintained httparty

Resolves security vulnerabilities in unmaintained rest-client dependency while preserving complete API compatibility for customers.

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.

…curity

- Replace unmaintained rest-client dependency with actively maintained httparty

- Maintain full backwards compatibility - no customer code changes required

- Remove rest-client cookie jar threading workaround

- Rewrite HTTP client implementation using httparty

- Update error handling to map Net::HTTP exceptions to existing Nylas exceptions

- Preserve JSON response parsing with symbol keys

- Maintain multipart file upload functionality

- Add comprehensive integration tests for migration validation

- Update dependencies in gemspec and remove rest-client requires

- All 227 tests passing with 99.42% code coverage maintained

Resolves security vulnerabilities in unmaintained rest-client dependency while preserving complete API compatibility for customers.
- Fix RSpec/DescribeClass: Use class name instead of string

- Fix RSpec/MessageSpies: Use have_received with spies instead of expect().to receive()

- Fix Layout/TrailingWhitespace: Remove trailing whitespace
AaronDDM added 3 commits June 2, 2025 14:40
- Create file_upload_example.rb demonstrating both <3MB and >3MB file handling

- Test small files: JSON with base64 encoding

- Test large files: Multipart form data uploads

- Add NYLAS_TEST_EMAIL environment variable for sending test emails

- Update examples README with new file upload example documentation

- Successfully tested with real API calls - both file sizes work correctly

- Validates HTTParty migration handles all file upload scenarios properly
…for large uploads

- Replace vague test_example.rb with comprehensive send_message_example.rb

- Demonstrate simple messages, multi-recipient, and HTML content

- Update file_upload_example.rb to use persistent disk file for >3MB test

- Large test file is created once and reused, avoiding repeated 5MB file creation

- Ensure NYLAS_TEST_EMAIL environment variable is used consistently

- Update examples README with new send_message_example documentation

- Both examples successfully tested with real API calls
- Large test file should be generated by the example, not tracked in git

- Added examples/messages/large_test_file.txt to .gitignore

- Removed the file from git tracking but left it on disk for reuse
@AaronDDM AaronDDM requested a review from quzhi1 June 3, 2025 14:44
@AaronDDM
Copy link
Contributor Author

AaronDDM commented Jun 3, 2025

@quzhi1 do you mind having a quick look at this PR - it's kinda a big change on the deps side but should have 0 impact on the end user side.

… key mismatch between FileUtils.handle_message_payload (symbol keys) and HttpClient.build_request (string key checks) - HttpClient.build_request now checks for both string and symbol multipart keys - Maintains 100% backwards compatibility with existing code - Prevents encoding errors when sending emails with attachments >3MB - Added comprehensive tests for both string and symbol key scenarios - Added integration test verifying FileUtils + HttpClient compatibility
@duncanmorrissey
Copy link

Hi @AaronDDM ! Any idea when this PR may be merged to main? We'd love to get the multipart fix released in our app. It's fixed the issue locally for me when I've tried it out.

Appreciate the help.

@AaronDDM
Copy link
Contributor Author

@quzhi1 do you mind having a quick look at this PR - it's kinda a big change on the deps side but should have 0 impact on the end user side.

Sorry for the delay, been out sick. I am going to try and get it out this week - worst case, Friday.

@AaronDDM AaronDDM merged commit 5779315 into main Jun 11, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants