[Jifty-commit] r599 -

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sat Feb 18 23:46:41 EST 2006


Author: jesse
Date: Sat Feb 18 23:46:41 2006
New Revision: 599

Modified:
   /   (props changed)
   jifty/trunk/lib/Jifty/Dispatcher.pm

Log:
 r23866 at truegrounds:  jesse | 2006-02-18 20:45:25 -0800
 * Switch from redirecting to add a trailing / to sub-dispatching.
 * no longer strip a trailing slash as soon as we have it.


Modified: jifty/trunk/lib/Jifty/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Dispatcher.pm	(original)
+++ jifty/trunk/lib/Jifty/Dispatcher.pm	Sat Feb 18 23:46:41 2006
@@ -637,17 +637,28 @@
     $path = "$self->{cwd}/$path" unless $path =~ m{^/};
 
     # If we're requesting a directory, go looking for the index.html
-    if ($path =~ m{/$} and 
-        Jifty->handler->mason->interp->comp_exists($path."/index.html")) {
-         $path .= "index.html" 
+    if ( $path =~ m{/$} and
+        Jifty->handler->mason->interp->comp_exists( $path . "/index.html" ) )
+    {
+        warn "Canonicalized $path with /index.html";
+        $path .= "/index.html";
     }
-    # Redirect to directory (and then index) if they requested 
+
+    # Redirect to directory (and then index) if they requested
     # the directory itself
-    
+
     # XXX TODO, we should search all component roots
-    $self->_do_redirect($path . "/") 
-      if $path !~ m{/$} and -d Jifty::Util->absolute_path( (Jifty->config->framework('Web')->{'TemplateRoot'} || "html") . $path );
     
+    if ($path !~ m{/$}
+        and -d Jifty::Util->absolute_path(
+            Jifty->config->framework('Web')->{'TemplateRoot'} . $path
+        )
+        )
+    {
+
+        $self->_do_dispatch( $path . "/" );
+    }
+
     # Set the request path
     request->path($path);
 
@@ -704,7 +715,6 @@
 
     # Normalize the path.
     $self->{path} =~ s{/+}{/}g;
-    $self->{path} =~ s{/$}{};
 
     $self->log->debug("Dispatching request to ".$self->{path});
     eval {


More information about the Jifty-commit mailing list