Log Message:
-----------
Fixed a bug with the file editor that did not process the file name
correctly in the top-level directory.
Fixed a bug in uploading a file where the name was given a sequence
number even when one was not needed.
Modified Files:
--------------
webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor:
FileManager.pm
Revision Data
-------------
Index: FileManager.pm
===================================================================
RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/FileManager.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -Llib/WeBWorK/ContentGenerator/Instructor/FileManager.pm -Llib/WeBWorK/ContentGenerator/Instructor/FileManager.pm -u -r1.6 -r1.7
--- lib/WeBWorK/ContentGenerator/Instructor/FileManager.pm
+++ lib/WeBWorK/ContentGenerator/Instructor/FileManager.pm
@@ -373,7 +373,8 @@
my $pwd = $self->{pwd};
if ($filename) {
$pwd = substr($filename,length($self->{courseRoot})+1);
- $pwd =~ s!/([^/]*)$!!; $filename = $1;
+ $pwd =~ s!(/|^)([^/]*)$!!; $filename = $2;
+ $pwd = '.' if $pwd eq '';
} else {
$filename = $self->getFile("save"); return unless $filename;
}
@@ -776,6 +777,7 @@
#
sub uniqueName {
my $dir = shift; my $name = shift;
+ return $name unless (-e "$dir/$name");
my $type = ""; my $n = -1;
$type = $1 if ($name =~ s/(\.[^.]*)$//);
$n = $1 if ($name =~ s/(\d+)$//);
|