This file documents the revision history for Perl extension Catalyst.
+ - Fixed path dispatch to canonicalise correctly
+ (see http://dev.catalyst.perl.org/ticket/62)
+
5.64
- Removed YAML support
use strict;
use base qw/Catalyst::DispatchType/;
use Text::SimpleTable;
+use URI;
=head1 NAME
my ( $self, $c, $path, $action ) = @_;
$path =~ s!^/!!;
$path = '/' unless length $path;
+ $path = URI->new($path)->canonical;
$self->{paths}{$path} = $action;
}
my $path = $self->uri->path;
my $location = $self->base->path;
$path =~ s/^(\Q$location\E)?//;
- $path =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
$path =~ s/^\///;
$self->{path} = $path;
BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
-use Test::More tests => 24*$iters;
+use Test::More tests => 30*$iters;
use Catalyst::Test 'TestApp';
if ( $ENV{CAT_BENCHMARK} ) {
'Content is a serialized Catalyst::Request'
);
}
+
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/local/two/foo%2Fbar'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/local/two', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Local',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/arguments => \[\s*'foo%2Fbar'\s*\]/,
+ "Parameters don't split on %2F"
+ );
+ }
}
{
ok(
my $response =
- request('http://localhost/action/path/a path with spaces'),
+ request('http://localhost/action/path/a%20path%20with%20spaces'),
'Request'
);
ok( $response->is_success, 'Response Successful 2xx' );
is( $response->content_type, 'text/plain', 'Response Content-Type' );
is(
$response->header('X-Catalyst-Action'),
- 'action/path/a path with spaces',
+ 'action/path/a%20path%20with%20spaces',
'Test Action'
);
is(
ok( $response->is_success, 'Response Successful 2xx' );
is( $response->content_type, 'text/plain', 'Response Content-Type' );
is( $response->header('X-Catalyst-Action'),
- 'action/path/åäö', 'Test Action' );
+ 'action/path/%C3%A5%C3%A4%C3%B6', 'Test Action' );
is(
$response->header('X-Test-Class'),
'TestApp::Controller::Action::Path',