[Rt-commit] r6466 - in rt/branches/3.6-RELEASE/lib: t/data t/regression

ruz at bestpractical.com ruz at bestpractical.com
Mon Nov 20 18:26:55 EST 2006


Author: ruz
Date: Mon Nov 20 18:26:54 2006
New Revision: 6466

Added:
   rt/branches/3.6-RELEASE/lib/t/data/subject-with-folding-ws
Modified:
   rt/branches/3.6-RELEASE/lib/RT/I18N.pm
   rt/branches/3.6-RELEASE/lib/t/regression/04send_email.t
   rt/branches/3.6-RELEASE/lib/t/regression/06-mime_decoding.t

Log:
* tests and fix for folding white spaces in headers
* see also #5248 at rt3.fsck.com

Modified: rt/branches/3.6-RELEASE/lib/RT/I18N.pm
==============================================================================
--- rt/branches/3.6-RELEASE/lib/RT/I18N.pm	(original)
+++ rt/branches/3.6-RELEASE/lib/RT/I18N.pm	Mon Nov 20 18:26:54 2006
@@ -338,6 +338,10 @@
 	$str .= $prefix . $enc_str . $trailing;
     }
 
+    # We might have \n without trailing whitespace, which will result in
+    # invalid headers.
+    $str =~ s/\n//g;
+
     return ($str)
 }
 

Added: rt/branches/3.6-RELEASE/lib/t/data/subject-with-folding-ws
==============================================================================
--- (empty file)
+++ rt/branches/3.6-RELEASE/lib/t/data/subject-with-folding-ws	Mon Nov 20 18:26:54 2006
@@ -0,0 +1,10 @@
+Subject: =?ISO-8859-1?Q?te?=
+ =?ISO-8859-1?Q?st?=
+Date: Mon, 02 Jun 2003 20:58:30 +0200
+To: rt at example.com
+From: foo at example.com
+Mime-Version: 1.0
+Content-Type: text/plain; charset="iso-8859-1"
+Content-Transfer-Encoding: 8bit
+
+test

Modified: rt/branches/3.6-RELEASE/lib/t/regression/04send_email.t
==============================================================================
--- rt/branches/3.6-RELEASE/lib/t/regression/04send_email.t	(original)
+++ rt/branches/3.6-RELEASE/lib/t/regression/04send_email.t	Mon Nov 20 18:26:54 2006
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 
 use strict;
-use Test::More tests => 136;
+use Test::More tests => 139;
 
 use RT;
 RT::LoadConfig();
@@ -520,6 +520,18 @@
 
 # }}}
 
+diag q{regression test for #5248 from rt3.fsck.com} if $ENV{TEST_VERBOSE};
+{
+    my $content = file_content("$RT::BasePath/lib/t/data/subject-with-folding-ws");
+    my ($status, $msg, $ticket) = RT::Interface::Email::Gateway(
+        { message => $content, queue => 1, action => 'correspond' }
+    );
+    ok ($status, 'created ticket') or diag "error: $msg";
+    ok ($ticket->id, "found ticket ". $ticket->id);
+    is ($ticket->Subject, 'test', 'correct subject');
+}
+
+
 # Don't taint the environment
 $everyone->PrincipalObj->RevokeRight(Right =>'SuperUser');
 1;

Modified: rt/branches/3.6-RELEASE/lib/t/regression/06-mime_decoding.t
==============================================================================
--- rt/branches/3.6-RELEASE/lib/t/regression/06-mime_decoding.t	(original)
+++ rt/branches/3.6-RELEASE/lib/t/regression/06-mime_decoding.t	Mon Nov 20 18:26:54 2006
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 use strict;
 use warnings;
-use Test::More tests => 5;
+use Test::More tests => 6;
 
 use_ok("RT");
 
@@ -41,3 +41,14 @@
     );
 }
 
+diag q{regression test for #5248 from rt3.fsck.com} if $ENV{TEST_VERBOSE};
+{
+    my $str = qq{Subject: =?ISO-8859-1?Q?Re=3A_=5BXXXXXX=23269=5D_=5BComment=5D_Frag?=}
+        . qq{\n =?ISO-8859-1?Q?e_zu_XXXXXX--xxxxxx_/_Xxxxx=FCxxxxxxxxxx?=};
+    is(
+        RT::I18N::DecodeMIMEWordsToUTF8($str),
+        qq{Subject: Re: [XXXXXX#269] [Comment] Frage zu XXXXXX--xxxxxx / Xxxxxüxxxxxxxxxx},
+        "right decoding"
+    );
+}
+


More information about the Rt-commit mailing list