--- loncom/publisher/loncfile.pm 2004/05/26 22:31:30 1.56 +++ loncom/publisher/loncfile.pm 2004/08/12 06:50:15 1.59 @@ -9,7 +9,7 @@ # and displays a page showing the results of the action. # # -# $Id: loncfile.pm,v 1.56 2004/05/26 22:31:30 albertel Exp $ +# $Id: loncfile.pm,v 1.59 2004/08/12 06:50:15 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -289,11 +289,19 @@ sub checksuffix { } sub cleanDest { - my ($request,$dest)=@_; + my ($request,$dest,$subdir)=@_; #remove bad characters - if ($dest=~/[\#\?&%]/) { + my $foundbad=0; + if ($subdir && $dest =~/\./) { + $foundbad=1; + $dest=~s/\.//g; + } + if ($dest=~/[\#\?&%\"]/) { + $foundbad=1; + $dest=~s/[\#\?&%\"]//g; + } + if ($foundbad) { $request->print("

".&mt('Invalid characters in requested name have been removed.')."

"); - $dest=~s/[\#\?&%]//g; } return $dest; } @@ -750,7 +758,9 @@ performed and reported to the user. sub phaseone { my ($r,$fn,$uname,$udom)=@_; - my $newfilename=&cleanDest($r,$ENV{'form.newfilename'}); + my $doingdir=0; + if ($ENV{'form.action'} eq 'newdir') { $doingdir=1; } + my $newfilename=&cleanDest($r,$ENV{'form.newfilename'},$doingdir); $newfilename=&relativeDest($fn,$newfilename,$uname); $r->print('
'. ''.