]> BookStack Code Mirror - bookstack/commitdiff
Allow book, shelf, settings & profile form input validation to skip image 1900/head
authorTBK <redacted>
Tue, 3 Mar 2020 23:05:47 +0000 (00:05 +0100)
committerTBK <redacted>
Tue, 3 Mar 2020 23:17:53 +0000 (00:17 +0100)
app/Http/Controllers/BookController.php
app/Http/Controllers/BookshelfController.php
app/Http/Controllers/SettingController.php
app/Http/Controllers/UserController.php

index e7d788d91dde01b78fdd158035fe07fd6cd5f54e..bddfe3f6db005ceb8aa5857d4e44dcb399d57f17 100644 (file)
@@ -86,7 +86,7 @@ class BookController extends Controller
         $this->validate($request, [
             'name' => 'required|string|max:255',
             'description' => 'string|max:1000',
-            'image' => $this->getImageValidationRules(),
+            'image' => 'nullable|' . $this->getImageValidationRules(),
         ]);
 
         $bookshelf = null;
@@ -153,7 +153,7 @@ class BookController extends Controller
         $this->validate($request, [
             'name' => 'required|string|max:255',
             'description' => 'string|max:1000',
-            'image' => $this->getImageValidationRules(),
+            'image' => 'nullable|' . $this->getImageValidationRules(),
         ]);
 
         $book = $this->bookRepo->update($book, $request->all());
index ad5967c7c4c1ca736e0492f970ae98aecb22490c..a0e9b719939727feebe89020606638bf34217963 100644 (file)
@@ -85,7 +85,7 @@ class BookshelfController extends Controller
         $this->validate($request, [
             'name' => 'required|string|max:255',
             'description' => 'string|max:1000',
-            'image' => $this->getImageValidationRules(),
+            'image' => 'nullable|' . $this->getImageValidationRules(),
         ]);
 
         $bookIds = explode(',', $request->get('books', ''));
@@ -146,7 +146,7 @@ class BookshelfController extends Controller
         $this->validate($request, [
             'name' => 'required|string|max:255',
             'description' => 'string|max:1000',
-            'image' => $this->getImageValidationRules(),
+            'image' => 'nullable|' . $this->getImageValidationRules(),
         ]);
 
 
index 3ecdb9cdc2bf25606734e7e1e7c3bd071f685168..feb6521f3a69a68bedbe4573d1edfac098da01aa 100644 (file)
@@ -44,7 +44,7 @@ class SettingController extends Controller
         $this->preventAccessInDemoMode();
         $this->checkPermission('settings-manage');
         $this->validate($request, [
-            'app_logo' => $this->getImageValidationRules(),
+            'app_logo' => 'nullable|' . $this->getImageValidationRules(),
         ]);
 
         // Cycles through posted settings and update them
index f6465ca1e1690f08080878e00dd28e3b089d8628..55a4610bcbdd3052acdeab15d28e707df0677e48 100644 (file)
@@ -155,7 +155,7 @@ class UserController extends Controller
             'password'         => 'min:6|required_with:password_confirm',
             'password-confirm' => 'same:password|required_with:password',
             'setting'          => 'array',
-            'profile_image'    => $this->getImageValidationRules(),
+            'profile_image'    => 'nullable|' . $this->getImageValidationRules(),
         ]);
 
         $user = $this->userRepo->getById($id);