[Rt-commit] rt branch, 4.0/emailinputencodings-postloadcheck-encodings, created. rt-4.0.6-244-g3f343c2
Jim Brandt
jbrandt at bestpractical.com
Mon Jul 9 09:38:11 EDT 2012
The branch, 4.0/emailinputencodings-postloadcheck-encodings has been created
at 3f343c29a92f00a65853f4f770066489da2b1695 (commit)
- Log -----------------------------------------------------------------
commit 2993261ecaac2d20436ac97aae277a71be82625b
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Mon Jul 9 09:28:39 2012 -0400
Test showing iso-8859-1 encoding is dropped from EmailInputEncodings
The EmailInputEncodings PostLoadCheck in RT/Config.pm removes
iso-8859-1 from the original config list even though it is
a valid encoding.
diff --git a/t/api/config.t b/t/api/config.t
index a986c3c..62b77df 100644
--- a/t/api/config.t
+++ b/t/api/config.t
@@ -1,7 +1,8 @@
use strict;
use warnings;
use RT;
-use RT::Test nodb => 1, tests => 9;
+use RT::Test nodb => 1, tests => 11;
+use Test::Warn;
ok(
RT::Config->AddOption(
@@ -31,3 +32,12 @@ is( $meta->{Widget}, '/Widgets/Form/Boolean', 'widget is updated to boolean' );
ok( RT::Config->DeleteOption( Name => 'foo' ), 'removed option foo' );
is( RT::Config->Meta('foo'), undef, 'foo is indeed deleted' );
+# Test EmailInputEncodings PostLoadCheck code
+RT::Config->Set('EmailInputEncodings', qw(utf-8 iso-8859-1 us-ascii foo));
+my @encodings = qw(utf-8-strict iso-8859-1 ascii);
+
+warning_is {RT::Config->PostLoadCheck} "Unknown encoding 'foo' in \@EmailInputEncodings option",
+ 'Correct warning for encoding foo';
+
+my @canonical_encodings = RT::Config->Get('EmailInputEncodings');
+is_deeply(\@encodings, \@canonical_encodings, 'Got correct encoding list');
commit 3f343c29a92f00a65853f4f770066489da2b1695
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Mon Jul 9 09:31:42 2012 -0400
Retain canonical encodings in EmailInputEncodings
Encodings provided to the EmailInputEncodings PostLoadCheck already
in the canonical form would be omitted from the processed list.
The initial increment in %seen added the encoding so it
was already "seen" when checked later with the $canonic
form. These encodings then were not added back to the list.
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index d26624f..ba338bb 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -738,7 +738,7 @@ our %META = (
my %seen;
foreach my $encoding ( grep defined && length, splice @$value ) {
- next if $seen{ $encoding }++;
+ next if $seen{ $encoding };
if ( $encoding eq '*' ) {
unshift @$value, '*';
next;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list