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

Josh Lavin <[email protected]>
Newsgroups gmane.comp.web.interchange.cvs
Message-ID <[email protected]>
commit 2c9c489f7cc8c817580321389ea75da7ad621c3f
Author: Josh Lavin <[email protected]>
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);
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.