ePages 7.26.0 - DE_EPAGES/Core/API/Archive.pm

Package DE_EPAGES::Core::API::Archive

Provides functionality for unpacking archives and prevent unpacking malicious files. Some checks are done by the function ExtractFilesFromZipArchive

@EXPORT_OK
ExtractFilesFromZipArchive

Functions

ExtractFilesFromZipArchive

ExtractFilesFromZipArchive

Extract files from given archive to the TargetFolder The archive

Syntax
ExtractFilesFromZipArchive($ArchiveFile, $TargetFolder, $hParams);
Input
$ArchiveFile (string)
zip archive full path and filename
$TargetFolder (string)
target folder for extracting zip archive
$hParams (reference to hash)
arguments for this function:
  • DeleteAfterExtraction - (optional, default=1) delete archive after extracting - boolean
  • AllowOnlyImagesAndPDF - (optional, default=1) allow only image and pdf files - boolean
    (If 1 only image and pdf files are extracted)
  • FixPathErrors - (optional, default=0) path errors are corrected otherwise ignored
    (If 1 filepath with paths above $TargetFolder are shortened to $TargetFolder) - boolean
  • WarningOnFileError - (optional, default=1) warn if a path or filesize error was detected - boolean
    (for warn if we have potential malicious files)
  • MaxContentLength - (optional, default=102400 kB) max uncompressed size in kB of a member in the archive - boolean
    (files with uncompressed size > MaxContentLength are ignored )