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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 28 Dec 2004 21:28:49 -0000


albertel		Tue Dec 28 16:28:49 2004 EDT

  Modified files:              
    /loncom/publisher	loncfile.pm 
  Log:
  - copying was not allowing copyng between dirs, also fixed the english on the error statement. BUG#3768
  
  
Index: loncom/publisher/loncfile.pm
diff -u loncom/publisher/loncfile.pm:1.63 loncom/publisher/loncfile.pm:1.64
--- loncom/publisher/loncfile.pm:1.63	Fri Sep 10 16:05:03 2004
+++ loncom/publisher/loncfile.pm	Tue Dec 28 16:28:49 2004
@@ -9,7 +9,7 @@
 #  and displays a page showing the results of the action.
 #
 #
-# $Id: loncfile.pm,v 1.63 2004/09/10 20:05:03 albertel Exp $
+# $Id: loncfile.pm,v 1.64 2004/12/28 21:28:49 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -289,7 +289,7 @@
 }
 
 sub cleanDest {
-    my ($request,$dest,$subdir,$fn)=@_;
+    my ($request,$dest,$subdir,$fn,$uname)=@_;
     #remove bad characters
     my $foundbad=0;
     if ($subdir && $dest =~/\./) {
@@ -302,8 +302,9 @@
     }
     if ($dest=~m|/|) {
 	my ($newpath)=($dest=~m|(.*)/|);
-	if (! -d "$fn/$newpath") {
-	    $request->print("<p><font color=\"red\">".&mt('You request to create file in directory [_1] which doesn\'t exist. The requested directory path has been removed from the requested file name.','"<tt>'.$newpath.'</tt>"')."</font></p>");
+	$newpath=&relativeDest($fn,$newpath,$uname);
+	if (! -d "$newpath") {
+	    $request->print("<p><font color=\"red\">".&mt('You have requested to create file in directory [_1] which doesn\'t exist. The requested directory path has been removed from the requested file name.','"<tt>'.$newpath.'</tt>"')."</font></p>");
 	    $dest=~s|.*/||;
 	}
     }
@@ -767,7 +768,7 @@
   
     my $doingdir=0;
     if ($ENV{'form.action'} eq 'newdir') { $doingdir=1; }
-    my $newfilename=&cleanDest($r,$ENV{'form.newfilename'},$doingdir,$fn);
+    my $newfilename=&cleanDest($r,$ENV{'form.newfilename'},$doingdir,$fn,$uname);
     $newfilename=&relativeDest($fn,$newfilename,$uname);
     $r->print('<form action="/adm/cfile" method="post">'.
 	      '<input type="hidden" name="qualifiedfilename" value="'.$fn.'" />'.