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 regression in content_type for text part after converted to multipart #1330

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

jeremyevans
Copy link
Contributor

This was broken by 404ecdd. It removed
the setting of the default :content_type entry for the text part, before
copying the content fields to the text part. This puts back the setting
of the default :content_type entry for the text part.

In 2.7.1:

m = Mail.new
m.body 'c'
m.add_file :filename=>'a.txt', :content=>'b'
m.parts.first.content_type =~ /text\/plain/ # => 0

Before this commit:

m = Mail.new
m.body 'c'
m.add_file :filename=>'a.txt', :content=>'b'
m.parts.first.content_type =~ /text\/plain/ # => nil

m.encoded
m.parts.first.content_type =~/text\/plain/ # => 0

After this commit:

m = Mail.new
m.body 'c'
m.add_file :filename=>'a.txt', :content=>'b'
m.parts.first.content_type =~ /text\/plain/ # => 0

Regression found by Roda's mailer plugin tests.

@mikel
Copy link
Owner

mikel commented Dec 3, 2022

Hi there @jeremyevans good work on this, sorry for the radio silence. Can you please rebase this against Master and against 2-8-stable and I'll get these released in the next updates.

@mikel mikel modified the milestones: 2.8.0, 2.9.0 Dec 3, 2022
…part

This was broken by 404ecdd.  It removed
the setting of the default :content_type entry for the text part, before
copying the content fields to the text part.  This puts back the setting
of the default :content_type entry for the text part.

In 2.7.1:

```ruby
m = Mail.new
m.body 'c'
m.add_file :filename=>'a.txt', :content=>'b'
m.parts.first.content_type =~ /text\/plain/ # => 0
```

Before this commit:

```ruby
m = Mail.new
m.body 'c'
m.add_file :filename=>'a.txt', :content=>'b'
m.parts.first.content_type =~ /text\/plain/ # => nil

m.encoded
m.parts.first.content_type =~ /text\/plain/ # => 0
```

After this commit:

```ruby
m = Mail.new
m.body 'c'
m.add_file :filename=>'a.txt', :content=>'b'
m.parts.first.content_type =~ /text\/plain/ # => 0
```
@jeremyevans jeremyevans force-pushed the content-type-regression-fix branch from 992e8fe to 89f55e5 Compare December 3, 2022 16:34
@jeremyevans
Copy link
Contributor Author

@mikel OK, this is rebased against master. Would you like me to send a separate pull request that is against 2-8-stable?

@radar
Copy link
Collaborator

radar commented Jan 21, 2025

Thanks @jeremyevans. I think we will get this into the 2.9.x release I plan on cutting in the next few weeks.

@radar radar merged commit d1d65b3 into mikel:master Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants