A free open source IT asset/license management system
Fixed #19808 - added missing models to file enums
snipe3472113259b4
diff --git a/app/Enums/FileStorage.php b/app/Enums/FileStorage.phpindex f246c13270..b09cc06a29 100644--- a/app/Enums/FileStorage.php+++ b/app/Enums/FileStorage.php@@ -98,8 +98,10 @@ enum FileStorage: stringself::Assets,self::Audits,self::Backups,+ self::Companies,self::Components,self::Consumables,+ self::Departments,self::EulaPdfs,self::Imports,self::Licenses,@@ -107,6 +109,7 @@ enum FileStorage: stringself::Maintenances,self::Models,self::Signatures,+ self::Suppliers,self::Users => true,default => false,};diff --git a/tests/Unit/Enums/FileStorageTest.php b/tests/Unit/Enums/FileStorageTest.phpindex 4a57839d1e..244dc889a4 100644--- a/tests/Unit/Enums/FileStorageTest.php+++ b/tests/Unit/Enums/FileStorageTest.php@@ -3,6 +3,7 @@namespace Tests\Unit\Enums;use App\Enums\FileStorage;+use App\Http\Controllers\Controller;use Tests\TestCase;class FileStorageTest extends TestCase@@ -162,6 +163,20 @@ class FileStorageTest extends TestCase$this->assertSame(\App\Models\AssetModel::class, FileStorage::Models->modelClass());}+ public function test_every_mapped_storage_path_resolves_to_a_private_key(): void+ {+ // Regression test for #19808. Suppliers / Companies / Departments+ // appear in Controller::getMapStoragePath() for file attachments+ // but were missing from FileStorage::hasPrivateScope(), so+ // privateStorageKey() returned null and UploadedFilesController+ // crashed with a TypeError when uploading. Pin the invariant+ // that every entry in the controller map produces a usable path.+ foreach (Controller::getMapStoragePath() as $resource => $path) {+ $this->assertIsString($path, "No private storage key for '$resource'. Add the matching case to FileStorage::hasPrivateScope().");+ $this->assertNotSame('', $path);+ }+ }+public function test_model_class_is_null_for_non_model_owned_cases(): void{// Signatures, EULA PDFs, audits, imports, backups, and the