From 16c2b606b44e0420dedb50a0098f4c8bb86e6f46 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Mon, 31 Oct 2022 12:29:10 -0400 Subject: [PATCH] Add ManifestDoesNotExistException and Solution (#4455) Co-authored-by: Matthew Penner --- .../ManifestDoesNotExistException.php | 15 +++++++++++ .../ManifestDoesNotExistSolution.php | 25 +++++++++++++++++++ app/Services/Helpers/AssetHashService.php | 8 +++++- 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 app/Exceptions/ManifestDoesNotExistException.php create mode 100644 app/Exceptions/Solutions/ManifestDoesNotExistSolution.php diff --git a/app/Exceptions/ManifestDoesNotExistException.php b/app/Exceptions/ManifestDoesNotExistException.php new file mode 100644 index 000000000..2769cd03c --- /dev/null +++ b/app/Exceptions/ManifestDoesNotExistException.php @@ -0,0 +1,15 @@ + 'https://github.com/pterodactyl/panel/blob/develop/package.json', + ]; + } +} diff --git a/app/Services/Helpers/AssetHashService.php b/app/Services/Helpers/AssetHashService.php index 2e1c1aaa6..725a56669 100644 --- a/app/Services/Helpers/AssetHashService.php +++ b/app/Services/Helpers/AssetHashService.php @@ -5,6 +5,7 @@ namespace Pterodactyl\Services\Helpers; use Illuminate\Support\Arr; use Illuminate\Filesystem\FilesystemManager; use Illuminate\Contracts\Filesystem\Filesystem; +use Pterodactyl\Exceptions\ManifestDoesNotExistException; class AssetHashService { @@ -106,6 +107,11 @@ class AssetHashService ); } - return static::$manifest; + $manifest = static::$manifest; + if ($manifest === null) { + throw new ManifestDoesNotExistException(); + } + + return $manifest; } }