--- loncom/publisher/lonpublisher.pm 2005/05/20 18:28:22 1.195 +++ loncom/publisher/lonpublisher.pm 2005/05/30 16:56:46 1.196 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Publication Handler # -# $Id: lonpublisher.pm,v 1.195 2005/05/20 18:28:22 www Exp $ +# $Id: lonpublisher.pm,v 1.196 2005/05/30 16:56:46 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1398,13 +1398,29 @@ sub phasetwo { my ($r,$source,$target,$style,$distarget,$batch)=@_; $source=~s/\/+/\//g; $target=~s/\/+/\//g; - - if ($target=~/\_\_\_/) { - $r->print( - ''.&mt('Unsupported character combination'). - ' "___" '.&mt('in filename, FAIL').''); - return 0; +# +# Unless trying to get rid of something, check name validity +# + unless ($env{'form.obsolete'}) { + if ($target=~/(\_\_\_|\&\&\&|\:\:\:)/) { + $r->print( + ''.&mt('Unsupported character combination'). + ' "'.$1.'" '.&mt('in filename, FAIL').''); + return 0; + } + unless ($target=~/\.(\w+)$/) { + $r->print(''.&mt('No valid extension found in filename, FAIL').''); + return 0; + } + if ($target=~/\.(\d+)\.(\w+)$/) { + $r->print(''.&mt('Cannot publish versioned resource, FAIL').''); + return 0; + } } + +# +# End name check +# $distarget=~s/\/+/\//g; my $logfile; unless ($logfile=Apache::File->new('>>'.$source.'.log')) {