[Catalyst-commits] r13177 - in Catalyst-Runtime/5.80/trunk: .
lib/Catalyst/DispatchType t/aggregate
t/lib/TestApp/Controller/Action
ajgb at dev.catalyst.perl.org
ajgb at dev.catalyst.perl.org
Wed Apr 21 11:10:51 GMT 2010
Author: ajgb
Date: 2010-04-21 12:10:51 +0100 (Wed, 21 Apr 2010)
New Revision: 13177
Modified:
Catalyst-Runtime/5.80/trunk/Changes
Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Regex.pm
Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_uri_for_action.t
Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Action/Regexp.pm
Log:
Fix not stripping backslashes in DispatchType::Regex::uri_for_action
Modified: Catalyst-Runtime/5.80/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.80/trunk/Changes 2010-04-20 14:45:21 UTC (rev 13176)
+++ Catalyst-Runtime/5.80/trunk/Changes 2010-04-21 11:10:51 UTC (rev 13177)
@@ -11,6 +11,7 @@
dereferencing it. (RT#49267)
- Fix regex special characters in REDIRECT_URL variable breaking
the request base. (2nd part of RT#24951)
+ - Fix not stripping backslashes in DispatchType::Regex::uri_for_action
New features:
- Setting __PACKAGE__->config(enable_catalyst_header => 1); in your MyApp.pm
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Regex.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Regex.pm 2010-04-20 14:45:21 UTC (rev 13176)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Regex.pm 2010-04-21 11:10:51 UTC (rev 13177)
@@ -151,6 +151,7 @@
my $re = "$orig";
$re =~ s/^\^//;
$re =~ s/\$$//;
+ $re =~ s/\\([^\\])/$1/g;
my $final = '/';
my @captures = @$captures;
while (my ($front, $rest) = split(/\(/, $re, 2)) {
Modified: Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_uri_for_action.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_uri_for_action.t 2010-04-20 14:45:21 UTC (rev 13176)
+++ Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_uri_for_action.t 2010-04-21 11:10:51 UTC (rev 13177)
@@ -8,7 +8,7 @@
use Test::More;
-plan tests => 30;
+plan tests => 33;
use_ok('TestApp');
@@ -54,6 +54,21 @@
"/action/regexp/foo/123",
"Regex action interpolates captures correctly");
+my $regex_action_bs = $dispatcher->get_action_by_path(
+ '/action/regexp/one_backslashes'
+ );
+
+ok(!defined($dispatcher->uri_for_action($regex_action_bs)),
+ "Regex action without captures returns undef");
+
+ok(!defined($dispatcher->uri_for_action($regex_action_bs, [ 1, 2, 3 ])),
+ "Regex action with too many captures returns undef");
+
+is($dispatcher->uri_for_action($regex_action_bs, [ 'foo', 123 ]),
+ "/action/regexp/foo/123.html",
+ "Regex action interpolates captures correctly");
+
+
#
# Index Action
#
Modified: Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Action/Regexp.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Action/Regexp.pm 2010-04-20 14:45:21 UTC (rev 13176)
+++ Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Action/Regexp.pm 2010-04-21 11:10:51 UTC (rev 13177)
@@ -27,4 +27,9 @@
);
}
+sub one_backslashes : Action Regex('^action/regexp/(\w+)/(\d+)\.html$') {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
1;
More information about the Catalyst-commits
mailing list