fixed: Gallery now gives an error message when a Zip archive is being naughty
This commit is contained in:
parent
edb0f2f622
commit
980dc18831
3 changed files with 14 additions and 2 deletions
|
|
@ -103,7 +103,7 @@ sub addArchive {
|
|||
|
||||
my $archive = Archive::Any->new( $filename );
|
||||
|
||||
croak "Archive will extract to directory outside of storage location!"
|
||||
die "Archive will extract to directory outside of storage location!\n"
|
||||
if $archive->is_naughty;
|
||||
|
||||
my $tempdirName = tempdir( "WebGUI-Gallery-XXXXXXXX", TMPDIR => 1, CLEANUP => 1);
|
||||
|
|
@ -882,7 +882,12 @@ sub www_addArchiveSave {
|
|||
}
|
||||
my $filename = $storage->getPath( $storage->getFiles->[0] );
|
||||
|
||||
$self->addArchive( $filename, $properties );
|
||||
eval { $self->addArchive( $filename, $properties ) };
|
||||
if ( my $error = $@ ) {
|
||||
return $self->www_addArchive({
|
||||
error => sprintf( $i18n->get('addArchive error generic'), $error ),
|
||||
});
|
||||
}
|
||||
|
||||
$storage->delete;
|
||||
|
||||
|
|
|
|||
|
|
@ -311,6 +311,12 @@ our $I18N = {
|
|||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'addArchive error generic' => {
|
||||
message => 'There was an error uploading your archive: %s',
|
||||
lastUpdated => 0,
|
||||
context => 'Lead in to an error message from WebGUI',
|
||||
},
|
||||
|
||||
'template url_addPhoto' => {
|
||||
message => 'Add a Photo',
|
||||
lastUpdated => 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue