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

www lon-capa-cvs@mail.lon-capa.org
Sat, 03 Apr 2004 00:23:47 -0000


www		Fri Apr  2 19:23:47 2004 EDT

  Modified files:              
    /loncom/publisher	loncfile.pm 
  Log:
  Bug #2870: do not allow directory to be renamed with MIME-type extension.
  
  
Index: loncom/publisher/loncfile.pm
diff -u loncom/publisher/loncfile.pm:1.52 loncom/publisher/loncfile.pm:1.53
--- loncom/publisher/loncfile.pm:1.52	Tue Mar  2 11:48:27 2004
+++ loncom/publisher/loncfile.pm	Fri Apr  2 19:23:47 2004
@@ -9,7 +9,7 @@
 #  and displays a page showing the results of the action.
 #
 #
-# $Id: loncfile.pm,v 1.52 2004/03/02 16:48:27 albertel Exp $
+# $Id: loncfile.pm,v 1.53 2004/04/03 00:23:47 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -426,6 +426,14 @@
 	    #renaming a dir, delete the trailing /
             #remove second to last element for current dir
 	    if (-d $fn) {
+		$newfilename=~/\.(\w+)$/;
+		if (&Apache::loncommon::fileembstyle($1) eq 'ssi') {
+		    $request->print('<br /><font color="red">'.
+				 &mt('Cannot change MIME type of a directory').
+				    '</font>'.
+			'<br /><a href="'.&url($fn).'">'.&mt('Cancel').'</a>');
+		    return;
+		}
 		$newfilename=~s/\/[^\/]+\/([^\/]+)$/\/$1/;
 	    }
 	    $newfilename=~s://+:/:g; # remove duplicate /