--- loncom/publisher/loncfile.pm 2005/07/14 22:49:26 1.70
+++ loncom/publisher/loncfile.pm 2005/11/08 17:58:35 1.73
@@ -9,7 +9,7 @@
# and displays a page showing the results of the action.
#
#
-# $Id: loncfile.pm,v 1.70 2005/07/14 22:49:26 raeburn Exp $
+# $Id: loncfile.pm,v 1.73 2005/11/08 17:58:35 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -69,7 +69,6 @@ use File::Copy;
use HTML::Entities();
use Apache::Constants qw(:common :http :methods);
use Apache::loncacc;
-use Apache::Log ();
use Apache::lonnet;
use Apache::loncommon();
use Apache::lonlocal;
@@ -101,16 +100,9 @@ my $r; # Needs to be global for some
=cut
sub Debug {
-
- # Marshall the parameters.
-
- my $r = shift;
- my $log = $r->log;
- my $message = shift;
-
# Put out the indicated message butonly if DEBUG is true.
-
if ($DEBUG) {
+ my ($r,$message) = @_;
$r->log_reason($message);
}
}
@@ -321,9 +313,9 @@ sub cleanDest {
$foundbad=1;
$dest=~s/\.//g;
}
- if ($dest=~/[\#\?&%\"]/) {
+ if ($dest=~/[\#\?&%\":]/) {
$foundbad=1;
- $dest=~s/[\#\?&%\"]//g;
+ $dest=~s/[\#\?&%\":]//g;
}
if ($dest=~m|/|) {
my ($newpath)=($dest=~m|(.*)/|);
@@ -1025,7 +1017,7 @@ sub Delete2 {
=back
-Returns 0 failure, and 0 successs.
+Returns 0 failure, and 1 successs.
=cut
@@ -1033,6 +1025,10 @@ sub Copy2 {
my ($request, $username, $dir, $oldfile, $newfile) = @_;
&Debug($request ,"Will try to copy $oldfile to $newfile");
if(-e $oldfile) {
+ if ($oldfile eq $newfile) {
+ $request->print(' '.&mt('Warning').': '.&mt('Name of new file is the same as name of old file').' - '.&mt('no action taken').'.');
+ return 1;
+ }
unless (copy($oldfile, $newfile)) {
$request->print(' '.&mt('copy Error').': '.$!.'');
return 0;