diff --git a/app/Http/Controllers/ItemController.php b/app/Http/Controllers/ItemController.php index 0d87ba297..ed39c48c9 100644 --- a/app/Http/Controllers/ItemController.php +++ b/app/Http/Controllers/ItemController.php @@ -267,9 +267,10 @@ public static function storelogic(Request $request, $id = null): Item ], ]; + $file = $request->input('icon'); $path_parts = pathinfo($file); - if (!isset($path_parts['extension'])) { + if (!array_key_exists('extension', $path_parts)) { throw ValidationException::withMessages(['file' => 'Icon URL must have a valid file extension.']); } $extension = $path_parts['extension']; @@ -312,7 +313,11 @@ public static function storelogic(Request $request, $id = null): Item $storedConfigObject = json_decode($storedItem->getAttribute('description')); $configObject = json_decode($config); - $configObject->password = $storedConfigObject->password; + if ($storedConfigObject && property_exists($storedConfigObject, 'password')) { + $configObject->password = $storedConfigObject->password; + } else { + $configObject->password = null; + } $config = json_encode($configObject); }