fix(installer): ensure valid tempFile & extractDir

Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
This commit is contained in:
Ferdinand Thiessen 2025-05-16 16:44:38 +02:00 committed by Andy Scherzinger
parent 6e82b961ca
commit 4b1fa4569d
3 changed files with 9 additions and 5 deletions

View file

@ -2599,9 +2599,6 @@
<code><![CDATA[$matches[0][$last_match]]]></code>
<code><![CDATA[$matches[1][$last_match]]]></code>
</InvalidArrayOffset>
<InvalidScalarArgument>
<code><![CDATA[$path]]></code>
</InvalidScalarArgument>
<UndefinedInterfaceMethod>
<code><![CDATA[getQuota]]></code>
</UndefinedInterfaceMethod>

View file

@ -241,6 +241,10 @@ class Installer {
// Download the release
$tempFile = $this->tempManager->getTemporaryFile('.tar.gz');
if ($tempFile === false) {
throw new \RuntimeException('Could not create temporary file for downloading app archive.');
}
$timeout = $this->isCLI ? 0 : 120;
$client = $this->clientService->newClient();
$client->get($app['releases'][0]['download'], ['sink' => $tempFile, 'timeout' => $timeout]);
@ -252,8 +256,11 @@ class Installer {
if ($verified === true) {
// Seems to match, let's proceed
$extractDir = $this->tempManager->getTemporaryFolder();
$archive = new TAR($tempFile);
if ($extractDir === false) {
throw new \RuntimeException('Could not create temporary directory for unpacking app.');
}
$archive = new TAR($tempFile);
if (!$archive->extract($extractDir)) {
$errorMessage = 'Could not extract app ' . $appId;

View file

@ -206,7 +206,7 @@ class OC_Helper {
$exts = [''];
$check_fn = 'is_executable';
// Default check will be done with $path directories :
$dirs = explode(PATH_SEPARATOR, $path);
$dirs = explode(PATH_SEPARATOR, (string)$path);
// WARNING : We have to check if open_basedir is enabled :
$obd = OC::$server->get(IniGetWrapper::class)->getString('open_basedir');
if ($obd != 'none') {