Mailing List Archive

Multiple slashes in uri_for arg not being URL-encoded
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",

_______________________________________________
Catalyst-dev mailing list
Catalyst-dev@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev
Re: Multiple slashes in uri_for arg not being URL-encoded [ In reply to ]
On 25 Jan 2010, at 13:38, Greg Matheson wrote:

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

Thanks! Test applied as r12744. As I noted in irc, the syntax you're
using (without an action object) is actually a backwards compatibility
bug...

So I've fixed that bug (sorry, this means your stuff probably stops
working as you're relying on that bug right now), and does the right
thing (of encoding only when we have an action object or
uri_for_action is used), and also ensures to encode all the slashes
correctly - this was r12746.

Cheers
t0m


_______________________________________________
Catalyst-dev mailing list
Catalyst-dev@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev