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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Tue, 10 Jul 2007 23:34:55 -0000


albertel		Tue Jul 10 19:34:55 2007 EDT

  Modified files:              
    /loncom/publisher	loncfile.pm 
  Log:
  - BUG#4548 was able still to copy/rename a file to (name).(number).(extension)
  
  
Index: loncom/publisher/loncfile.pm
diff -u loncom/publisher/loncfile.pm:1.83 loncom/publisher/loncfile.pm:1.84
--- loncom/publisher/loncfile.pm:1.83	Thu Apr 26 17:17:16 2007
+++ loncom/publisher/loncfile.pm	Tue Jul 10 19:34:54 2007
@@ -9,7 +9,7 @@
 #  and displays a page showing the results of the action.
 #
 #
-# $Id: loncfile.pm,v 1.83 2007/04/26 21:17:16 albertel Exp $
+# $Id: loncfile.pm,v 1.84 2007/07/10 23:34:54 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -340,6 +340,12 @@
 	    $dest=~s|.*/||;
 	}
     }
+    if ($dest =~ /\.(\d+)\.(\w+)$/){
+	$request->print('<span class="LC_error">'
+			.&mt('Bad filename [_1].<br /> <tt>(name).(number).(extension)</tt> not allowed. <br /> Removing the <tt>.number.</tt> from requested filename.',$dest)
+			.'</span>');
+	$dest =~ s/\.(\d+)(\.\w+)$/$2/;
+    }
     if ($foundbad) {
 	$request->print("<p><span class=\"LC_error\">".&mt('Invalid characters in requested name have been removed.')."</span></p>");
     }