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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 10 Feb 2003 23:26:15 -0000


albertel		Mon Feb 10 18:26:15 2003 EDT

  Modified files:              
    /loncom/publisher	loncfile.pm 
  Log:
  - adding in BUGS#1246 suggestion on new file extensions
  
  
Index: loncom/publisher/loncfile.pm
diff -u loncom/publisher/loncfile.pm:1.25 loncom/publisher/loncfile.pm:1.26
--- loncom/publisher/loncfile.pm:1.25	Mon Feb 10 18:19:45 2003
+++ loncom/publisher/loncfile.pm	Mon Feb 10 18:26:15 2003
@@ -9,7 +9,7 @@
 #  and displays a page showing the results of the action.
 #
 #
-# $Id: loncfile.pm,v 1.25 2003/02/10 23:19:45 albertel Exp $
+# $Id: loncfile.pm,v 1.26 2003/02/10 23:26:15 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -764,6 +764,10 @@
     if ($ENV{'form.action'} =~ /new(.+)file/) {
 	my $extension=$1;
 	if ($newfilename !~ /\Q.$extension\E$/) {
+	    if ($newfilename =~ m|^[^\.]*\.([^\.]+)$|) {
+		#already has an extension strip it and add in expected one
+		$newfilename =~ s|.([^\.]+)$||;
+	    }
 	    $newfilename.=".$extension";
 	}
     }