Skip to content
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

Support custom attachment filename for large files #502

Merged

Conversation

loomchild
Copy link
Contributor

@loomchild loomchild commented Nov 13, 2024

Description

Add support for attachments > 3MB.
Follow-up of #496.

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.

file.define_singleton_method(:original_filename) { filename } if filename

content_type = attachment[:content_type] || attachment["content_type"]
file.define_singleton_method(:content_type) { content_type } if content_type
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not be required - added as a bonus.

@@ -36,6 +36,13 @@ def self.build_form_request(request_body)
file = File.open(attachment[:file_path], "rb")
end

# Setting original filename and content type if available. See code rest-client#lib/restclient/payload.rb
Copy link
Contributor Author

@loomchild loomchild Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using not fully documented rest-client feature to set the filename in the payload. See https://github.com/rest-client/rest-client/blob/master/lib/restclient/payload.rb#L185 for more info.

@SubashPradhan SubashPradhan merged commit 3677a0b into nylas:main Nov 15, 2024
5 of 6 checks passed
@SubashPradhan SubashPradhan mentioned this pull request Dec 2, 2024
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.

2 participants