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

Fix add_file append valid header in multipart. #895

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/mail/message.rb
Expand Up @@ -1771,7 +1771,7 @@ def add_file(values)
basename = File.basename(values)
filedata = File.open(values, 'rb') { |f| f.read }
else
basename = values[:filename]
basename = values.delete(:filename)
filedata = values
unless filedata[:content]
filedata = values.merge(:content=>File.open(values[:filename], 'rb') { |f| f.read })
Expand Down
1 change: 1 addition & 0 deletions spec/mail/message_spec.rb
Expand Up @@ -109,6 +109,7 @@ def basic_email
raw_email = "From jamis_buck@byu.edu Mon May 2 16:07:05 2005\r\n#{m.to_s}"

expect { Mail::Message.new(raw_email) }.not_to raise_error
expect(Mail::Message.new(raw_email).part[0].header[:filename]).to be_nil
end

it "should not raise a warning on having non US-ASCII characters in the header (should just handle it)" do
Expand Down