[LON-CAPA-cvs] cvs: loncom /publisher lonpubdir.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 09 Apr 2002 06:01:56 -0000


albertel		Tue Apr  9 02:01:56 2002 EDT

  Modified files:              
    /loncom/publisher	lonpubdir.pm 
  Log:
  - fixes BUG #261, $r->filname() isn't correct for non users, need to use $r->uri and fix it up
  
  
Index: loncom/publisher/lonpubdir.pm
diff -u loncom/publisher/lonpubdir.pm:1.23 loncom/publisher/lonpubdir.pm:1.24
--- loncom/publisher/lonpubdir.pm:1.23	Fri Feb  8 20:38:54 2002
+++ loncom/publisher/lonpubdir.pm	Tue Apr  9 02:01:56 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # (Publication Handler
 #
-# $Id: lonpubdir.pm,v 1.23 2002/02/09 01:38:54 foxr Exp $
+# $Id: lonpubdir.pm,v 1.24 2002/04/09 06:01:56 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -153,8 +153,16 @@
 	#  Remove trailing / strings (?) 
 	
 	$fn=~s/\/[^\/]+$//;
-    } else {			# If no form is defined, use request filename.
-	$fn=$r->filename();
+    } else {
+	#   If no form is defined, use request filename.
+	$fn = $r->filename();
+	my $lonDocRoot=$r->dir_config('lonDocRoot');
+	if ( $fn =~ /$lonDocRoot/ ) {
+	    #internal authentication, needs fixup.
+	    $fn = $r->uri(); # non users do not get the full path request
+                             # through SCRIPT_FILENAME
+	    $fn=~s|^/~(\w+)|/home/$1/public_html|;
+	}
     }
     return $fn;
 }