URI-decode chained args
Rafael Kitover [Tue, 26 May 2009 15:52:37 +0000 (15:52 +0000)]
lib/Catalyst/DispatchType/Chained.pm
t/aggregate/live_component_controller_action_chained.t

index 8600ac0..18e7c59 100644 (file)
@@ -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;
 
index 70b539d..5adf520 100644 (file)
@@ -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' );
     }
 }