[Catalyst-dev] Multiple slashes in uri_for arg not being URL-encoded

Greg Matheson drbean at freeshell.org
Mon Jan 25 13:38:19 GMT 2010


Only the first of the slashes is being encoded. See Catalyst.pm, 
line 1271.

diff -u -b t/aggregate/unit_core_uri_for.t.orig t/aggregate/unit_core_uri_for.t
--- t/aggregate/unit_core_uri_for.t.orig        2010-01-25 21:52:04.000000000 +0900
+++ t/aggregate/unit_core_uri_for.t     2010-01-25 22:35:01.000000000 +0900
@@ -1,7 +1,7 @@
 use strict;
 use warnings;

-use Test::More tests => 20;
+use Test::More tests => 21;
 use URI;

 use_ok('Catalyst');
@@ -133,6 +133,13 @@
     );
 }

+# 5.80018 is only encoding the first of the / in the arg. See line 1271.
+is(
+Catalyst::uri_for( $context, 'controller/action', 'foo/bar/baz' )->as_string,
+'http://127.0.0.1/controller/action/foo%2Fbar%2Fbaz',
+'Escape both forward slashes in the arg as %2F'
+);
+
 # make sure caller's query parameter hash isn't messed up
 {
     my $query_params_base = {test => "one two",



More information about the Catalyst-dev mailing list