[LON-CAPA-cvs] cvs: loncom /publisher loncfile.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Thu, 19 Jun 2003 20:49:13 -0000
albertel Thu Jun 19 16:49:13 2003 EDT
Modified files:
/loncom/publisher loncfile.pm
Log:
- remove bad characters from file names(BUG#1242)
Index: loncom/publisher/loncfile.pm
diff -u loncom/publisher/loncfile.pm:1.30 loncom/publisher/loncfile.pm:1.31
--- loncom/publisher/loncfile.pm:1.30 Thu Jun 19 16:23:39 2003
+++ loncom/publisher/loncfile.pm Thu Jun 19 16:49:13 2003
@@ -9,7 +9,7 @@
# and displays a page showing the results of the action.
#
#
-# $Id: loncfile.pm,v 1.30 2003/06/19 20:23:39 albertel Exp $
+# $Id: loncfile.pm,v 1.31 2003/06/19 20:49:13 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -776,6 +776,12 @@
}
$newfilename.=".$extension";
}
+ }
+
+ #remove bad characters
+ if ($newfilename=~/[\#\?&]/) {
+ $request->print("<p><font color=\"red\">Invalid characters in requested filename have been removed.</font></p>");
+ $newfilename=~s/[\#\?&]//g;
}
my $fullpath = $dir.'/'.$newfilename;