https://bugzilla.redhat.com/show_bug.cgi?id=1855962

Dave Miller <justd...@bugzilla.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |justd...@bugzilla.org



--- Comment #1 from Dave Miller <justd...@bugzilla.org> ---
From the discussion on upstream Bugzilla's IRC:

Bugzilla's code was broken from the beginning, but a bug in Email::MIME prior
to 1.949 was accidentally making our code work.  1.949 fixed that bug, and
exposed the error in our code.

The proposed patch on this bug isn't quite correct, though.

What Bugzilla's existing code is trying to do:
- if the email has only one part (which happens in plaintext email), it tries
to copy the content type from that part to the email itself
- it does this by grabbing the Content-type header from that part and passing
it to content_type_set
- this is broken because it's grabbing the entire Content-type header from that
part, and passing it to a function designed explicitly to only set the type
itself and not the other attributes.

It works in Email::MIME 1.946 because when generating the Content-type header
it takes the type and subtype and puts them into the Content-type header
unchecked, and then starts adding attributes to it.  The attributes we passed
as part of the subtype, since they weren't checked, actually made it to the
header.  In 1.949, Email::MIME started using the build_content_type function
from Email::MIME::Header, which actually checks that the subtype is valid.

The code path at
https://github.com/bugzilla/bugzilla/blob/5.0/Bugzilla/BugMail.pm#L498
shouldn't be necessary at all.  Email::MIME, when generating an email which has
only one part, already copies the Content-type header from that one and only
part to the email itself, which you can see at
https://metacpan.org/release/Email-MIME/source/lib/Email/MIME.pm#L789 and in
Bugzilla's earliest-supported version of Email::MIME at
https://metacpan.org/source/RJBS/Email-MIME-1.904/lib/Email/MIME.pm#L658

So the correct fix is basically to remove that line of code (and the if block
only needs to act if there are multiple parts)

This should be re-filed upstream, and in my opinion the fix is worth
backporting to all supported branches, since email basically stops working if
you're set for sending text email.


-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
perl-devel mailing list -- perl-devel@lists.fedoraproject.org
To unsubscribe send an email to perl-devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/perl-devel@lists.fedoraproject.org

Reply via email to