Skip to content

NOW MANAGED ON CODEBERG

Remove redundant getImageValidationRules method

TBKd3737d5a879c
diff --git a/app/Http/Controllers/BookshelfController.php b/app/Http/Controllers/BookshelfController.php
index c882ca7c3..ad5967c7c 100644
--- a/app/Http/Controllers/BookshelfController.php
+++ b/app/Http/Controllers/BookshelfController.php
@@ -146,7 +146,7 @@ class BookshelfController extends Controller
$this->validate($request, [
'name' => 'required|string|max:255',
'description' => 'string|max:1000',
- 'image' => $this->imageRepo->getImageValidationRules(),
+ 'image' => $this->getImageValidationRules(),
]);
diff --git a/app/Http/Controllers/Images/GalleryImageController.php b/app/Http/Controllers/Images/GalleryImageController.php
index fd52ffd3f..e506215ca 100644
--- a/app/Http/Controllers/Images/GalleryImageController.php
+++ b/app/Http/Controllers/Images/GalleryImageController.php
@@ -48,7 +48,7 @@ class GalleryImageController extends Controller
{
$this->checkPermission('image-create-all');
$this->validate($request, [
- 'file' => $this->imageRepo->getImageValidationRules()
+ 'file' => $this->getImageValidationRules()
]);
try {
diff --git a/app/Http/Controllers/SettingController.php b/app/Http/Controllers/SettingController.php
index 9c51ef4af..3ecdb9cdc 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->imageRepo->getImageValidationRules(),
+ 'app_logo' => $this->getImageValidationRules(),
]);
// Cycles through posted settings and update them
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index c91b7678c..f6465ca1e 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->imageRepo->getImageValidationRules(),
+ 'profile_image' => $this->getImageValidationRules(),
]);
$user = $this->userRepo->getById($id);
diff --git a/app/Uploads/ImageRepo.php b/app/Uploads/ImageRepo.php
index 01b65f882..981c04673 100644
--- a/app/Uploads/ImageRepo.php
+++ b/app/Uploads/ImageRepo.php
@@ -219,12 +219,4 @@ class ImageRepo
return null;
}
}
-
- /**
- * Get the validation rules for image files.
- */
- public function getImageValidationRules(): string
- {
- return 'image_extension|no_double_extension|mimes:jpeg,png,gif,bmp,webp,tiff';
- }
}