From 8a092868561bed989a064e5f9c813d091b16d099 Mon Sep 17 00:00:00 2001 From: DariusIII Date: Wed, 3 Jan 2024 21:55:00 +0100 Subject: [PATCH] Separate zip and szip cases --- Blacklight/processing/post/ProcessAdditional.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Blacklight/processing/post/ProcessAdditional.php b/Blacklight/processing/post/ProcessAdditional.php index 9d0bb42bb..7f58581fd 100755 --- a/Blacklight/processing/post/ProcessAdditional.php +++ b/Blacklight/processing/post/ProcessAdditional.php @@ -931,16 +931,28 @@ class ProcessAdditional } break; case ArchiveInfo::TYPE_SZIP: - case ArchiveInfo::TYPE_ZIP: if ($this->_echoCLI) { $this->_echo('7z', 'primaryOver'); } + if (! $this->_extractUsingRarInfo && ! empty($this->_7zipPath)) { + $fileName = $this->tmpPath.uniqid('', true).'.7z'; + File::put($fileName, $compressedData); + // Pass the -p flag to the 7zip command to make sure it doesn't get stuck in password prompt + runCmd($this->_killString.$this->_7zipPath.'" x -tzip "'.$fileName.'" -p -bd -y -o"'.$this->tmpPath.'unzip/"'); + File::delete($fileName); + } + break; + case ArchiveInfo::TYPE_ZIP: + if ($this->_echoCLI) { + $this->_echo('z', 'primaryOver'); + } + if (! $this->_extractUsingRarInfo && ! empty($this->_7zipPath)) { $fileName = $this->tmpPath.uniqid('', true).'.zip'; File::put($fileName, $compressedData); // Pass the -p flag to the 7zip command to make sure it doesn't get stuck in password prompt - runCmd($this->_killString.$this->_7zipPath.'" x -tzip "'.$fileName.'" -p -bd -y -o"'.$this->tmpPath.'unzip/"'); + runCmd($this->_killString.$this->_7zipPath.'" x "'.$fileName.'" -p -bd -y -o"'.$this->tmpPath.'unzip/"'); File::delete($fileName); } break;