From: Rafael Kitover Date: Tue, 26 May 2009 15:52:37 +0000 (+0000) Subject: URI-decode chained args X-Git-Tag: 5.80005~24^2~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=634780e00f88651be2fe6f261d56604e313b369a;hp=2c527b9130ee042eaa8e5996f565c75764d18117 URI-decode chained args --- diff --git a/lib/Catalyst/DispatchType/Chained.pm b/lib/Catalyst/DispatchType/Chained.pm index 8600ac0..18e7c59 100644 --- a/lib/Catalyst/DispatchType/Chained.pm +++ b/lib/Catalyst/DispatchType/Chained.pm @@ -151,7 +151,13 @@ sub match { my @parts = split('/', $path); my ($chain, $captures, $parts) = $self->recurse_match($c, '/', \@parts); - push @{$request->args}, @$parts if $parts && @$parts; + + if ($parts && @$parts) { + for my $arg (@$parts) { + $arg =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; + push @{$request->args}, $arg; + } + } return 0 unless $chain; diff --git a/t/aggregate/live_component_controller_action_chained.t b/t/aggregate/live_component_controller_action_chained.t index 70b539d..5adf520 100644 --- a/t/aggregate/live_component_controller_action_chained.t +++ b/t/aggregate/live_component_controller_action_chained.t @@ -1009,7 +1009,6 @@ sub run_tests { ok( my $content = get('http://localhost/chained/return_arg/foo%2Fbar%3B'), 'request with URI-encoded arg' ); - # this is the CURRENT behavior - like( $content, qr{foo%2Fbar%3B\z}, 'args NOT decoded' ); + like( $content, qr{foo/bar;\z}, 'args decoded' ); } }