the ... part of '/foo...' should match ONLY empty string or something starting with /
Christian Walde [Mon, 19 Dec 2011 16:02:52 +0000 (17:02 +0100)]
lib/Web/Dispatch/Parser.pm
t/dispatch_parser.t

index 213edb0..1ccb650 100644 (file)
@@ -145,7 +145,7 @@ sub _url_path_match {
         or $self->_blam("Couldn't parse path match segment");
       /\G\.\.\./gc
         and do {
-          $end = '(.*)';
+          $end = '(|/.*)';
           last PATH;
         };
       /\G\.\*/gc
index 8b6f4ab..6cfcb9e 100644 (file)
@@ -329,6 +329,12 @@ my $dp = Web::Dispatch::Parser->new;
   my $sub = $dp->parse($match);
 
   is_deeply(
+    [ $sub->({ PATH_INFO => '/foobar' }) ],
+    [],
+    "$match does not match /foobar"
+  );
+
+  is_deeply(
     [ $sub->({ PATH_INFO => '/foo/bar' }) ],
     [ { PATH_INFO => '/bar', SCRIPT_NAME => '/foo' } ],
     "$match matches /foo/bar and strips to /bar"