1
0
mirror of https://github.com/flarum/core.git synced 2025-08-05 16:07:34 +02:00

fix(package-manager): file not found exception

This commit is contained in:
Sami Mazouz
2024-01-06 13:07:02 +01:00
parent 2a693db1b6
commit 7fb0e08c0a

View File

@@ -13,6 +13,7 @@ use Flarum\Foundation\Paths;
use Flarum\Http\RequestUtil; use Flarum\Http\RequestUtil;
use Flarum\PackageManager\Composer\ComposerJson; use Flarum\PackageManager\Composer\ComposerJson;
use Flarum\PackageManager\ConfigureComposerValidator; use Flarum\PackageManager\ConfigureComposerValidator;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Illuminate\Filesystem\Filesystem; use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Laminas\Diactoros\Response\JsonResponse; use Laminas\Diactoros\Response\JsonResponse;
@@ -110,7 +111,11 @@ class ConfigureComposerController implements RequestHandlerInterface
$this->validator->assertValid(['auth' => $data]); $this->validator->assertValid(['auth' => $data]);
$authJson = json_decode($this->filesystem->get($this->paths->base.'/auth.json'), true); try {
$authJson = json_decode($this->filesystem->get($this->paths->base.'/auth.json'), true);
} catch (FileNotFoundException $e) {
$authJson = [];
}
if (! is_null($data)) { if (! is_null($data)) {
foreach ($data as $type => $hosts) { foreach ($data as $type => $hosts) {