Secure and fix the Zip Archive.
This commit is contained in:
parent
13a222f6ce
commit
7251cc2c23
3 changed files with 73 additions and 4 deletions
44
t/Asset/File/ZipArchive.t
Normal file
44
t/Asset/File/ZipArchive.t
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use FindBin;
|
||||
use strict;
|
||||
use lib "$FindBin::Bin/../../lib";
|
||||
|
||||
use WebGUI::Storage;
|
||||
use WebGUI::Asset;
|
||||
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;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
|
||||
my $arch = $node->addChild({
|
||||
className => 'WebGUI::Asset::File::ZipArchive',
|
||||
});
|
||||
|
||||
WebGUI::Test->addToCleanup($arch);
|
||||
|
||||
my $storage = $arch->getStorageLocation;
|
||||
$storage->addFileFromFilesystem(WebGUI::Test->getTestCollateralPath('extensions.tar'));
|
||||
ok($arch->unzip($storage, 'extensions.tar'), 'unzip returns true when it successfully unpacked');
|
||||
|
||||
$arch->fixFilenames();
|
||||
|
||||
cmp_bag(
|
||||
$storage->getFiles,
|
||||
[ qw{ extensions.tar extension_pm.txt extension_perl.txt extension.html extensions extensions/extension.html }],
|
||||
'files after fixFilenames, html files left alone'
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue