Permalink
Browse files

Fix: component.mc wins over index/dhandlers without trailing slash

Signed-off-by: Pedro Melo <melo@simplicidade.org>
  • Loading branch information...
1 parent bdd2292 commit 233f45bf5d8030f8cf6659c46f1a5da42ff7988d @pstadt pstadt committed with Jan 8, 2013
Showing with 15 additions and 0 deletions.
  1. +4 −0 lib/Mason/Interp.pm
  2. +11 −0 lib/Mason/t/ResolveURI.pm
View
@@ -487,6 +487,10 @@ method _build_match_request_path ($interp:) {
my @candidate_paths =
( $path_info eq '' && !@autoextensions ) ? ($path)
: ( $path eq '/' ) ? ( @index_subpaths, @dhandler_subpaths )
+ : ( $trailing_slash eq '/' ) ? (
+ ( map { $path . $_ } ( @index_subpaths, @dhandler_subpaths ) ),
+ ( grep { !/$ignore_file_regex/ } map { $path . $_ } @autoextensions )
+ )
: (
( grep { !/$ignore_file_regex/ } map { $path . $_ } @autoextensions ),
( map { $path . $_ } ( @index_subpaths, @dhandler_subpaths ) )
View
@@ -125,6 +125,17 @@ sub test_resolve : Tests {
$try->( '/news/sports/', ['/news/dhandler'], '/news/dhandler', 'sports/');
$try->( '/news/sports/', ['/news.mc'], undef);
$try->( '/news/sports/', ['/news.mc=1'], '/news.mc', 'sports/');
+ $try->( '/news/sports', ['/news/sports/index','/news/sports.mc'], '/news/sports.mc', '');
+ $try->( '/news/sports/', ['/news/sports/index','/news/sports.mc'], '/news/sports/index', '');
+ $try->( '/news/sports/', ['/news/sports/index=1','/news/sports.mc'], '/news/sports/index', '/');
+ $try->( '/news/sports', ['/news/sports/dhandler','/news/sports.mc'], '/news/sports.mc', '');
+ $try->( '/news/sports/', ['/news/sports/dhandler','/news/sports.mc'], '/news/sports/dhandler', '/');
+ $try->( '/news/sports', ['/news/dhandler','/news/sports.mc'], '/news/sports.mc', '');
+ $try->( '/news/sports/', ['/news/dhandler','/news/sports.mc'], '/news/sports.mc', '');
+ $try->( '/news/sports/', ['/news/dhandler','/news/sports.mc=1'], '/news/sports.mc', '/');
+ $try->( '/news/sports', ['/dhandler','/news.mc'], '/dhandler', 'news/sports');
+ $try->( '/news/sports/', ['/dhandler','/news.mc'], '/dhandler', 'news/sports/');
+ $try->( '/news/sports/', ['/dhandler','/news.mc=1'], '/news.mc', 'sports/');
}
sub test_decline : Tests {

0 comments on commit 233f45b

Please sign in to comment.