Skip to content

NOW MANAGED ON CODEBERG

Allow book, shelf, settings & profile form input validation to skip image

TBK57f587a78b47
diff --git a/app/Http/Controllers/BookController.php b/app/Http/Controllers/BookController.php
index e7d788d91..bddfe3f6d 100644
--- a/app/Http/Controllers/BookController.php
+++ b/app/Http/Controllers/BookController.php
@@ -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());
diff --git a/app/Http/Controllers/BookshelfController.php b/app/Http/Controllers/BookshelfController.php
index ad5967c7c..a0e9b7199 100644
--- a/app/Http/Controllers/BookshelfController.php
+++ b/app/Http/Controllers/BookshelfController.php
@@ -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(),
]);
diff --git a/app/Http/Controllers/SettingController.php b/app/Http/Controllers/SettingController.php
index 3ecdb9cdc..feb6521f3 100644
--- a/app/Http/Controllers/SettingController.php
+++ b/app/Http/Controllers/SettingController.php
@@ -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
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index f6465ca1e..55a4610bc 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -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);