[interchange] Allow DirectoryIndex to find index page in root pages/ dir:

Josh Lavin interchange-cvs at icdevgroup.org
Fri May 2 20:25:34 UTC 2014


commit 2c9c489f7cc8c817580321389ea75da7ad621c3f
Author: Josh Lavin <josh at perusion.com>
Date:   Fri May 2 13:21:46 2014 -0700

    Allow DirectoryIndex to find index page in root pages/ dir:
    
    It seems DirectoryIndex, when the readin() sub doesn't find a page
    for '', adds a slash, so it then looks for '/index'. This is wrong
    when acting on the root pages/ directory, so now we check if the
    page is blank, and if so skip the slash.
    
    Came to light when attempting to serve a root index.html page via
    PageTables.

 lib/Vend/Page.pm |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/lib/Vend/Page.pm b/lib/Vend/Page.pm
index 1a1f2a0..725aee2 100644
--- a/lib/Vend/Page.pm
+++ b/lib/Vend/Page.pm
@@ -127,7 +127,8 @@ sub display_page {
 	# Try one last time for page with index
 	if(! defined $page and $Vend::Cfg->{DirectoryIndex}) {
 		my $try = $name;
-		$try =~ s!/*$!/$Vend::Cfg->{DirectoryIndex}!;
+		my $slash = length($try) ? '/' : '';
+		$try =~ s!/*$!$slash$Vend::Cfg->{DirectoryIndex}!;
 		$page = readin($try);
 	}
 



More information about the interchange-cvs mailing list