]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Controllers/Images/DrawioImageController.php
Added more complexity in an attempt to make ldap host failover fit
[bookstack] / app / Http / Controllers / Images / DrawioImageController.php
index d99bb8e6f6acbb080712e8089bdfe7cfb4e2c36c..cab1c925e414855a3a8be13b08e2c825dc101360 100644 (file)
@@ -44,8 +44,8 @@ class DrawioImageController extends Controller
     public function create(Request $request)
     {
         $this->validate($request, [
-            'image'       => 'required|string',
-            'uploaded_to' => 'required|integer',
+            'image'       => ['required', 'string'],
+            'uploaded_to' => ['required', 'integer'],
         ]);
 
         $this->checkPermission('image-create-all');
@@ -67,13 +67,12 @@ class DrawioImageController extends Controller
     public function getAsBase64($id)
     {
         $image = $this->imageRepo->getById($id);
-        $page = $image->getPage();
-        if ($image === null || $image->type !== 'drawio' || !userCan('page-view', $page)) {
+        if (is_null($image) || $image->type !== 'drawio' || !userCan('page-view', $image->getPage())) {
             return $this->jsonError('Image data could not be found');
         }
 
         $imageData = $this->imageRepo->getImageData($image);
-        if ($imageData === null) {
+        if (is_null($imageData)) {
             return $this->jsonError('Image data could not be found');
         }