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

raeburn lon-capa-cvs@mail.lon-capa.org
Tue, 16 Aug 2005 15:52:12 -0000


raeburn		Tue Aug 16 11:52:12 2005 EDT

  Modified files:              
    /loncom/publisher	loncfile.pm 
  Log:
  Fix bug 4257.
  
  
Index: loncom/publisher/loncfile.pm
diff -u loncom/publisher/loncfile.pm:1.70 loncom/publisher/loncfile.pm:1.71
--- loncom/publisher/loncfile.pm:1.70	Thu Jul 14 18:49:26 2005
+++ loncom/publisher/loncfile.pm	Tue Aug 16 11:52:08 2005
@@ -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.71 2005/08/16 15:52:08 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1025,7 +1025,7 @@
 
 =back
 
-Returns 0 failure, and 0 successs.
+Returns 0 failure, and 1 successs.
 
 =cut
 
@@ -1033,6 +1033,10 @@
     my ($request, $username, $dir, $oldfile, $newfile) = @_;
     &Debug($request ,"Will try to copy $oldfile to $newfile");
     if(-e $oldfile) {
+        if ($oldfile eq $newfile) {
+            $request->print('<font color="red"> '.&mt('Warning').': '.&mt('Name of new file is the same as name of old file').' - '.&mt('no action taken').'.</font>');
+            return 1;
+        }
 	unless (copy($oldfile, $newfile)) {
 	    $request->print('<font color="red"> '.&mt('copy Error').': '.$!.'</font>');
 	    return 0;