[Rt-commit] rt branch, 4.0/rfc2231-param-continuations, updated. rt-4.0.4-115-g1dca0dd

Thomas Sibley trs at bestpractical.com
Fri Dec 9 16:03:56 EST 2011


The branch, 4.0/rfc2231-param-continuations has been updated
       via  1dca0dd8d3b711f2df33976d7f0ef8eed9e2418d (commit)
      from  3b65a0a4401c1fc691908f4687cff791816bd0aa (commit)

Summary of changes:
 t/mail/specials-in-encodedwords.t |   39 +++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)
 create mode 100644 t/mail/specials-in-encodedwords.t

- Log -----------------------------------------------------------------
commit 1dca0dd8d3b711f2df33976d7f0ef8eed9e2418d
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Dec 9 16:01:27 2011 -0500

    Test that specials in MIME encoded words are treated as quoted
    
    RT is unorthodox and decodes before parsing.  This means that special
    characters which are inside MIME encoded words need to be protected in
    order not to be interpreted as a separator in the header.
    
    This tests part of DecodeMIMEWordsToEncoding in RT::I18N.

diff --git a/t/mail/specials-in-encodedwords.t b/t/mail/specials-in-encodedwords.t
new file mode 100644
index 0000000..4712386
--- /dev/null
+++ b/t/mail/specials-in-encodedwords.t
@@ -0,0 +1,39 @@
+use strict;
+use warnings;
+
+use RT::Test tests => undef;
+
+diag "specials (, and ;) in MIME encoded-words aren't treated as specials";
+{
+    # RT decodes too early in the game (i.e. before parsing), so it needs to
+    # ensure special characters in encoded words are properly escaped/quoted
+    # after decoding
+
+    RT->Config->Set( ParseNewMessageForTicketCcs => 1 );
+    my $mail = <<'.';
+From: root at localhost
+Subject: testing mime encoded specials
+Cc: a at example.com, =?utf8?q?d=40example.com=2ce=40example.com=3b?=
+    <b at example.com>; c at example.com
+Content-Type: text/plain; charset=utf8
+
+here's some content
+.
+
+    my ( $status, $id ) = RT::Test->send_via_mailgate($mail);
+    is( $status >> 8, 0, "The mail gateway exited normally" );
+    ok( $id, "Created ticket" );
+
+    my $ticket = RT::Ticket->new( RT->SystemUser );
+    $ticket->Load($id);
+    ok $ticket->id, 'loaded ticket';
+
+    my @cc = @{$ticket->Cc->UserMembersObj->ItemsArrayRef};
+    is scalar @cc, 3, "three ccs";
+    for my $addr (qw(a b c)) {
+        ok (scalar grep { $_->EmailAddress eq "$addr\@example.com" } @cc), "found $addr";
+    }
+}
+
+done_testing;
+

-----------------------------------------------------------------------


More information about the Rt-commit mailing list