31
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2024-05-28 19:30:48 +00:00

support all file etensions that Joomla is able to unpack (zip, tar, tgz, tbz2, tar.gz, tar.gzip, tar.bz2, tar.bzip2)

This commit is contained in:
Denis Ryabov 2021-11-16 19:56:11 +03:00
parent fa3ba35933
commit 3dd234ffde
2 changed files with 3 additions and 5 deletions

View File

@ -192,11 +192,9 @@ class JedcheckerControllerUploads extends JControllerLegacy
{
if ($file->isFile())
{
$extension = pathinfo($file->getFilename(), PATHINFO_EXTENSION);
if ($extension === 'zip')
if (preg_match('/\.(?:zip|tar|tgz|tbz2|tar\.(?:gz|gzip|bz2|bzip2))$/', $file->getFilename(), $matches))
{
$unzip = $file->getPath() . '/' . $file->getBasename('.' . $extension);
$unzip = $file->getPath() . '/' . $file->getBasename($matches[0]);
try
{

View File

@ -367,7 +367,7 @@ class JedcheckerRulesXMLFiles extends JEDcheckerRule
}
// Extra check for unzipped files
if (preg_match('/^(.*)\.(zip|tgz|tar\.gz)$/', $filename, $matches) && is_dir($matches[1]))
if (preg_match('/^(.*)\.(?:zip|tar|tgz|tbz2|tar\.(?:gz|gzip|bz2|bzip2))$/', $filename, $matches) && is_dir($matches[1]))
{
continue;
}