[interchange-cvs] interchange - docelic modified lib/Vend/Util.pm

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Thu Jan 8 18:43:13 UTC 2009


User:      docelic
Date:      2009-01-08 18:43:13 GMT
Modified:  lib/Vend Util.pm
Log:
* Correct .access functionality directly in pages/

  .access worked in subdirectories like pages/abc/, but didn't work directly
  under pages/. (Instead of looking for pages/.access, it was looking for
  pages/PAGENAME/.access)

Revision  Changes    Path
2.121                interchange/lib/Vend/Util.pm


rev 2.121, prev_rev 2.120
Index: Util.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Util.pm,v
retrieving revision 2.120
retrieving revision 2.121
diff -u -r2.120 -r2.121
--- Util.pm	26 Sep 2008 14:57:58 -0000	2.120
+++ Util.pm	8 Jan 2009 18:43:13 -0000	2.121
@@ -1,6 +1,6 @@
 # Vend::Util - Interchange utility functions
 #
-# $Id: Util.pm,v 2.120 2008-09-26 14:57:58 racke Exp $
+# $Id: Util.pm,v 2.121 2009-01-08 18:43:13 docelic Exp $
 # 
 # Copyright (C) 2002-2008 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -91,7 +91,7 @@
 use Vend::File;
 use subs qw(logError logGlobal);
 use vars qw($VERSION @EXPORT @EXPORT_OK);
-$VERSION = substr(q$Revision: 2.120 $, 10);
+$VERSION = substr(q$Revision: 2.121 $, 10);
 
 my $Eval_routine;
 my $Eval_routine_file;
@@ -1113,10 +1113,17 @@
 		logError( "Too many .. in file path '%s' for security.", $file );
 		$file = find_special_page('violation');
 	}
-	$file =~ s#//+#/#g;
-	$file =~ s#/+$##g;
-	($pathdir = $file) =~ s#/[^/]*$##;
-	$pathdir =~ s:^/+::;
+
+	if(index($file, '/') < 0) {
+		$pathdir = '';
+	}
+	else {
+		$file =~ s#//+#/#g;
+		$file =~ s#/+$##g;
+		($pathdir = $file) =~ s#/[^/]*$##;
+		$pathdir =~ s:^/+::;
+	}
+
 	my $try;
 	my $suffix = $Vend::Cfg->{HTMLsuffix};
 	my $db_tried;







More information about the interchange-cvs mailing list