[Catalyst] [PATCH] Misbehavior w/ URI and slashes

Dominique Quatravaux dom at idealx.com
Wed Jun 29 20:06:15 CEST 2005


Catalyst treats differently http://localhost:3000/application//edit/42
and http://localhost:3000/application/edit/42 . It really shouldn't.

Here is the patch, although I am under the impression that more bugs lie
in this area and that the "URI" module (already a dependency) does this
and then some...

Regards and thanks for your work!

-- 
Dominique QUATRAVAUX                           Ingénieur senior
01 44 42 00 08                                 IDEALX


-------------- next part --------------
Index: lib/Catalyst/Engine/HTTP/Base.pm
===================================================================
--- lib/Catalyst/Engine/HTTP/Base.pm	(revision 932)
+++ lib/Catalyst/Engine/HTTP/Base.pm	(working copy)
@@ -172,7 +172,8 @@
 
     my $path = $c->http->request->uri->path || '/';
     $path =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
-    $path =~ s/^\///;
+    $path =~ s|/+|/|g;
+    $path =~ s|^/||;
 
     $c->req->base($base);
     $c->req->path($path);


More information about the Catalyst mailing list