mirror of
https://github.com/nextcloud/server.git
synced 2026-05-25 02:34:12 -04:00
Merge pull request #54375 from nextcloud/backport/54373/stable30
[stable30] fix(installer): ensure valid tempFile & extractDir
This commit is contained in:
commit
037e378ff9
3 changed files with 9 additions and 5 deletions
|
|
@ -2842,9 +2842,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>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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') {
|
||||
|
|
|
|||
Loading…
Reference in a new issue