sendgrid / sendgrid-ruby

The Official Twilio SendGrid Led, Community Driven Ruby API Library
https://sendgrid.com
MIT License
620 stars 324 forks source link

fix: use `Base64.strict_encode64` instead of `Base64.encode64` #495

Open yujideveloper opened 1 year ago

yujideveloper commented 1 year ago

Fixes

When I used Base64.encode64 to encode attachments, I got the following error:

{
  "errors": [
    {
      "message": "The attachment content must be base64 encoded.",
      "field": "attachments.0.content",
      "help": "http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.attachments.content"
    }
  ]
}

It is resolved by changing to encode attachments using Base64.strict_encode64 where no line feeds are added.

Checklist

If you have questions, please file a support ticket, or create a GitHub Issue in this repository.