Skip to content

Commit

Permalink
fix(package-manager): file not found exception
Browse files Browse the repository at this point in the history
  • Loading branch information
SychO9 committed Jan 6, 2024
1 parent 2a693db commit 7fb0e08
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Flarum\Http\RequestUtil;
use Flarum\PackageManager\Composer\ComposerJson;
use Flarum\PackageManager\ConfigureComposerValidator;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Arr;
use Laminas\Diactoros\Response\JsonResponse;
Expand Down Expand Up @@ -110,7 +111,11 @@ protected function authConfig(ServerRequestInterface $request): array

$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)) {
foreach ($data as $type => $hosts) {
Expand Down

0 comments on commit 7fb0e08

Please sign in to comment.