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

Allow custom filename when adding an attachment #496

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

loomchild
Copy link

Description

When adding an attachment to an email, the filename that will be sent is determined by the provided file path. This is problematic when using Tempfile because part of the path will be random. I propose accepting an optional filename parameter in FileUtils.attach_file_request_builder.

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.

@@ -92,8 +92,8 @@ def self.handle_message_payload(request_body)
# Build the request to attach a file to a message/draft object.
# @param file_path [String] The path to the file to attach.
# @return [Hash] The request that will attach the file to the message/draft
def self.attach_file_request_builder(file_path)
filename = File.basename(file_path)
def self.attach_file_request_builder(file_path, filename = nil)
Copy link
Author

Choose a reason for hiding this comment

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

Alternatively, it could also be named parameter: filename: nil.

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.

1 participant