[LON-CAPA-cvs] cvs: loncom /publisher loncfile.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Fri, 30 Mar 2007 20:37:32 -0000
albertel Fri Mar 30 16:37:32 2007 EDT
Modified files:
/loncom/publisher loncfile.pm
Log:
- filenames can have perios in the directory names, need to only strip the filename
Index: loncom/publisher/loncfile.pm
diff -u loncom/publisher/loncfile.pm:1.80 loncom/publisher/loncfile.pm:1.81
--- loncom/publisher/loncfile.pm:1.80 Wed Dec 20 17:41:08 2006
+++ loncom/publisher/loncfile.pm Fri Mar 30 16:37:31 2007
@@ -9,7 +9,7 @@
# and displays a page showing the results of the action.
#
#
-# $Id: loncfile.pm,v 1.80 2006/12/20 22:41:08 albertel Exp $
+# $Id: loncfile.pm,v 1.81 2007/03/30 20:37:31 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -749,16 +749,16 @@
return;
}
if ($newfilename !~ /\Q.$extension\E$/) {
- if ($newfilename =~ m|^[^\.]*\.([^\.]+)$|) {
+ if ($newfilename =~ m|/[^/.]*\.(?:[^/.]+)$|) {
#already has an extension strip it and add in expected one
- $newfilename =~ s|.([^\.]+)$||;
+ $newfilename =~ s|(/[^./])\.(?:[^.]+)$|$1|;
}
$newfilename.=".$extension";
}
}
my $result=&exists($user,$domain,$newfilename);
if($result) {
- $request->print('<font color="red">'.$result.'</font></form>');
+ $request->print('<span class="LC_error">'.$result.'</span></form>');
} else {
$request->print('<p>'.&mt('Make new file').' '.&display($newfilename).'?</p>');
$request->print('</form>');