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:
@@ -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) {
|
||||||
|
Reference in New Issue
Block a user