mirror of
https://github.com/nextcloud/server.git
synced 2026-03-21 18:11:02 -04:00
fix: Throw AppNotFoundException from installer when application is not found
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
580911dc89
commit
c85f7eacb8
5 changed files with 21 additions and 3 deletions
|
|
@ -8,6 +8,7 @@ declare(strict_types=1);
|
|||
*/
|
||||
namespace OCA\Provisioning_API\Controller;
|
||||
|
||||
use OC\App\AppStore\AppNotFoundException;
|
||||
use OC\Installer;
|
||||
use OC_App;
|
||||
use OCP\App\AppPathNotFoundException;
|
||||
|
|
@ -124,7 +125,7 @@ class AppsController extends OCSController {
|
|||
$this->appManager->enableApp($app);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
throw new OCSException($e->getMessage(), OCSController::RESPOND_UNAUTHORISED);
|
||||
} catch (AppPathNotFoundException $e) {
|
||||
} catch (AppPathNotFoundException|AppNotFoundException $e) {
|
||||
throw new OCSException('The request app was not found', OCSController::RESPOND_NOT_FOUND);
|
||||
}
|
||||
return new DataResponse();
|
||||
|
|
|
|||
|
|
@ -1049,6 +1049,7 @@ return array(
|
|||
'OC\\AppScriptDependency' => $baseDir . '/lib/private/AppScriptDependency.php',
|
||||
'OC\\AppScriptSort' => $baseDir . '/lib/private/AppScriptSort.php',
|
||||
'OC\\App\\AppManager' => $baseDir . '/lib/private/App/AppManager.php',
|
||||
'OC\\App\\AppStore\\AppNotFoundException' => $baseDir . '/lib/private/App/AppStore/AppNotFoundException.php',
|
||||
'OC\\App\\AppStore\\Bundles\\Bundle' => $baseDir . '/lib/private/App/AppStore/Bundles/Bundle.php',
|
||||
'OC\\App\\AppStore\\Bundles\\BundleFetcher' => $baseDir . '/lib/private/App/AppStore/Bundles/BundleFetcher.php',
|
||||
'OC\\App\\AppStore\\Bundles\\EducationBundle' => $baseDir . '/lib/private/App/AppStore/Bundles/EducationBundle.php',
|
||||
|
|
|
|||
|
|
@ -1090,6 +1090,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
|
|||
'OC\\AppScriptDependency' => __DIR__ . '/../../..' . '/lib/private/AppScriptDependency.php',
|
||||
'OC\\AppScriptSort' => __DIR__ . '/../../..' . '/lib/private/AppScriptSort.php',
|
||||
'OC\\App\\AppManager' => __DIR__ . '/../../..' . '/lib/private/App/AppManager.php',
|
||||
'OC\\App\\AppStore\\AppNotFoundException' => __DIR__ . '/../../..' . '/lib/private/App/AppStore/AppNotFoundException.php',
|
||||
'OC\\App\\AppStore\\Bundles\\Bundle' => __DIR__ . '/../../..' . '/lib/private/App/AppStore/Bundles/Bundle.php',
|
||||
'OC\\App\\AppStore\\Bundles\\BundleFetcher' => __DIR__ . '/../../..' . '/lib/private/App/AppStore/Bundles/BundleFetcher.php',
|
||||
'OC\\App\\AppStore\\Bundles\\EducationBundle' => __DIR__ . '/../../..' . '/lib/private/App/AppStore/Bundles/EducationBundle.php',
|
||||
|
|
|
|||
13
lib/private/App/AppStore/AppNotFoundException.php
Normal file
13
lib/private/App/AppStore/AppNotFoundException.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OC\App\AppStore;
|
||||
|
||||
class AppNotFoundException extends \Exception {
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ declare(strict_types=1);
|
|||
namespace OC;
|
||||
|
||||
use Doctrine\DBAL\Exception\TableExistsException;
|
||||
use OC\App\AppStore\AppNotFoundException;
|
||||
use OC\App\AppStore\Bundles\Bundle;
|
||||
use OC\App\AppStore\Fetcher\AppFetcher;
|
||||
use OC\AppFramework\Bootstrap\Coordinator;
|
||||
|
|
@ -174,6 +175,7 @@ class Installer {
|
|||
* @param string $appId
|
||||
* @param bool [$allowUnstable]
|
||||
*
|
||||
* @throws AppNotFoundException If the app is not found on the appstore
|
||||
* @throws \Exception If the installation was not successful
|
||||
*/
|
||||
public function downloadApp(string $appId, bool $allowUnstable = false): void {
|
||||
|
|
@ -356,9 +358,9 @@ class Installer {
|
|||
}
|
||||
}
|
||||
|
||||
throw new \Exception(
|
||||
throw new AppNotFoundException(
|
||||
sprintf(
|
||||
'Could not download app %s',
|
||||
'Could not download app %s, it was not found on the appstore',
|
||||
$appId
|
||||
)
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue