-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix sending attachments less than 3MB #483
Fix sending attachments less than 3MB #483
Conversation
@mrashed-dev Thanks for raising this PR. I have an edge case: What if the clients doesn't specify a file but instead specify the base64 encoded content (i.e If they are not using our utility function) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good 👍
@kraju3 we have specified already in all the sending functions that it must be a file pointer: # @param request_body [Hash] The values to create the message with.
# If you're attaching files, you must pass an array of [File] objects, or
# you can use {FileUtils::attach_file_request_builder} to build each object attach. However, we can expand this function to be more flexible where we can accept a b64 encoded string, but only for attachments that total less than 3MB. Otherwise it has to be a file object because of how we stream files to the API. |
@kraju3 function comments updated along with code to support this operation: # @param request_body [Hash] The values to create the message with.
# If you're attaching files, you must pass an array of [File] objects, or
# you can pass in base64 encoded strings if the total attachment size is less than 3mb.
# You can also use {FileUtils::attach_file_request_builder} to build each object attach. |
Description
We were not encoding the attachments properly for attachments less than 3MB. They should be b64 encoded. Now it should handle it correctly.
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.