[Catalyst-commits] r10736 - in Catalyst-Runtime/5.80/trunk: . lib t
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Mon Jun 29 23:17:47 GMT 2009
Author: t0m
Date: 2009-06-29 23:17:47 +0000 (Mon, 29 Jun 2009)
New Revision: 10736
Modified:
Catalyst-Runtime/5.80/trunk/Changes
Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
Catalyst-Runtime/5.80/trunk/t/unit_core_uri_for.t
Log:
Don't mangle query parameters passed to uri_for, the list
Modified: Catalyst-Runtime/5.80/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.80/trunk/Changes 2009-06-29 22:07:09 UTC (rev 10735)
+++ Catalyst-Runtime/5.80/trunk/Changes 2009-06-29 23:17:47 UTC (rev 10736)
@@ -1,5 +1,9 @@
# This file documents the revision history for Perl extension Catalyst.
+ Bug fixes:
+ - Don't mangle query parameters passed to uri_for
+ - Tests for this (t0m + Byron Young + Amir Sadoughi)
+
5.80006 2009-06-29 23:37:47
Bug fixes:
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm 2009-06-29 22:07:09 UTC (rev 10735)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm 2009-06-29 23:17:47 UTC (rev 10736)
@@ -1232,12 +1232,12 @@
my $key = $_;
$val = '' unless defined $val;
(map {
- $_ = "$_";
- utf8::encode( $_ ) if utf8::is_utf8($_);
+ my $param = "$_";
+ utf8::encode( $param ) if utf8::is_utf8($param);
# using the URI::Escape pattern here so utf8 chars survive
- s/([^A-Za-z0-9\-_.!~*'() ])/$URI::Escape::escapes{$1}/go;
- s/ /+/g;
- "${key}=$_"; } ( ref $val eq 'ARRAY' ? @$val : $val ));
+ $param =~ s/([^A-Za-z0-9\-_.!~*'() ])/$URI::Escape::escapes{$1}/go;
+ $param =~ s/ /+/g;
+ "${key}=$param"; } ( ref $val eq 'ARRAY' ? @$val : $val ));
} @keys);
}
Modified: Catalyst-Runtime/5.80/trunk/t/unit_core_uri_for.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/unit_core_uri_for.t 2009-06-29 22:07:09 UTC (rev 10735)
+++ Catalyst-Runtime/5.80/trunk/t/unit_core_uri_for.t 2009-06-29 23:17:47 UTC (rev 10736)
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use Test::More tests => 19;
+use Test::More tests => 20;
use URI;
use_ok('Catalyst');
@@ -133,3 +133,13 @@
);
}
+# make sure caller's query parameter hash isn't messed up
+{
+ my $query_params_base = {test => "one two",
+ bar => ["foo baz", "bar"]};
+ my $query_params_test = {test => "one two",
+ bar => ["foo baz", "bar"]};
+ Catalyst::uri_for($context, '/bar/baz', $query_params_test);
+ is_deeply($query_params_base, $query_params_test,
+ "uri_for() doesn't mess up query parameter hash in the caller");
+}
More information about the Catalyst-commits
mailing list