Fixes bug #11780: anchor filename regex to the end of the string.

This commit is contained in:
Colin Kuskie 2010-08-15 23:23:49 -07:00
parent 05c287cfc7
commit 8f7bbdaa5d
3 changed files with 13 additions and 2 deletions

View file

@ -1,6 +1,7 @@
7.9.13
- fixed #11783: Instances deleted during realtime run
- fixed #11781: Thingy wrong retorn value from Ajax method
- fixed #11780: fixFilenames regex needs an anchor in ZipArchive asset
7.9.12
- webgui.org homepage gives 404 (#11778)

View file

@ -172,7 +172,8 @@ sub fixFilenames {
my $extension = $storage->getFileExtension($file);
next FILE unless isIn($extension, qw/pl perl pm cgi php asp sh/);
my $newFile = $file;
$newFile =~ s/\.$extension/_$extension.txt/;
#$newFile =~ s/\.$extension$/_$extension.txt/;
$newFile =~ s/\.$extension$/_$extension.txt/;
$storage->renameFile($file, $newFile);
}
}

View file

@ -19,7 +19,7 @@ use WebGUI::Asset::File::ZipArchive;
use WebGUI::Test;
use Test::More; # increment this value for each test you create
use Test::Deep;
plan tests => 2;
plan tests => 3;
my $session = WebGUI::Test->session;
@ -42,3 +42,12 @@ cmp_bag(
[ qw{ extensions.tar extension_pm.txt extension_perl.txt extension.html extensions extensions/extension.html }],
'files after fixFilenames, html files left alone'
);
$storage->addFileFromScalar('file.pm.pm','content');
$arch->fixFilenames();
cmp_bag(
$storage->getFiles,
[ qw{ extensions.tar extension_pm.txt extension_perl.txt extension.html extensions extensions/extension.html file_pm.pm.txt}],
'fixFilenames: anchors replacements to the end of the string'
);