[Rt-commit] rt branch, 4.0/encode-dashboard-subjects, created. rt-4.0.11rc1-1-gac8392a
Thomas Sibley
trs at bestpractical.com
Fri Apr 12 19:21:10 EDT 2013
The branch, 4.0/encode-dashboard-subjects has been created
at ac8392aae70f674417e89a0090abbfec25ab26ab (commit)
- Log -----------------------------------------------------------------
commit ac8392aae70f674417e89a0090abbfec25ab26ab
Author: Thomas Sibley <trs at bestpractical.com>
Date: Thu Mar 21 12:50:08 2013 -0700
Encode dashboard email header values properly for MIME
Dashboard names, included in the Subject, may contain Unicode characters
which need MIME-word encoding first. MIME::Entity doesn't handle this
for us. This was reported by Christian Loos <github at netsandbox.de>.
From and To are passed through encode_utf8() to avoid double encoding
issues in MIME::Entity, which only handles octets well. See the full
rationale in 57ea0c0.
Unlike Subject, From and To don't get the EncodeToMIME treatment because
MIME-word encoding From and To as an opaque blob is really, really
wrong. You need to encode on a per-recipient level using Email::Address
to parse, otherwise you can lose special chars such as commas into the
MIME-word. While From is likely just an email address, To is non-admin
user-input and may contain commas or an email phrase part or other
formatting. See also the bug [1] in ContentAsMIME where we _do_ use
EncodeToMIME on From and To and the hilarity that ensues for forwards,
the primary user of ContentAsMIME.
The correct solution for From and To will be to use the encoding logic
in 4.2-on-4.0/protect-more-chars-while-decoding-headers once it is merged.
[1] http://issues.bestpractical.com/Ticket/Display.html?id=19125
diff --git a/lib/RT/Dashboard/Mailer.pm b/lib/RT/Dashboard/Mailer.pm
index 0ad2fb2..9d28c49 100644
--- a/lib/RT/Dashboard/Mailer.pm
+++ b/lib/RT/Dashboard/Mailer.pm
@@ -396,7 +396,7 @@ sub BuildEmail {
Type => $mimetype,
Encoding => $encoding,
Disposition => 'inline',
- Name => $filename,
+ Name => RT::Interface::Email::EncodeToMIME( String => $filename ),
'Content-Id' => $cid_of{$uri},
);
@@ -411,9 +411,9 @@ sub BuildEmail {
);
my $entity = MIME::Entity->build(
- From => $args{From},
- To => $args{To},
- Subject => $args{Subject},
+ From => Encode::encode_utf8($args{From}),
+ To => Encode::encode_utf8($args{To}),
+ Subject => RT::Interface::Email::EncodeToMIME( String => $args{Subject} ),
Type => "multipart/mixed",
);
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list