]> BookStack Code Mirror - bookstack/commitdiff
Remove redundant getImageValidationRules method
authorTBK <redacted>
Tue, 3 Mar 2020 23:06:30 +0000 (00:06 +0100)
committerTBK <redacted>
Tue, 3 Mar 2020 23:17:49 +0000 (00:17 +0100)
app/Http/Controllers/BookshelfController.php
app/Http/Controllers/Images/GalleryImageController.php
app/Http/Controllers/SettingController.php
app/Http/Controllers/UserController.php
app/Uploads/ImageRepo.php

index c882ca7c32cf0521053d0afd84d48ab02b1ff7cf..ad5967c7c4c1ca736e0492f970ae98aecb22490c 100644 (file)
@@ -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(),
         ]);
 
 
index fd52ffd3fb6eaa30466345b2a08e60c0227ba009..e506215ca43b919a9d79d4b6ba743f33c39e13ca 100644 (file)
@@ -48,7 +48,7 @@ class GalleryImageController extends Controller
     {
         $this->checkPermission('image-create-all');
         $this->validate($request, [
-            'file' => $this->imageRepo->getImageValidationRules()
+            'file' => $this->getImageValidationRules()
         ]);
 
         try {
index 9c51ef4af2e888bfdfcbc18a9cb5a1a4c9ffd39b..3ecdb9cdc2bf25606734e7e1e7c3bd071f685168 100644 (file)
@@ -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
index c91b7678c58a075671ad89942685a0b7bafaa470..f6465ca1e1690f08080878e00dd28e3b089d8628 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->imageRepo->getImageValidationRules(),
+            'profile_image'    => $this->getImageValidationRules(),
         ]);
 
         $user = $this->userRepo->getById($id);
index 01b65f882698933b54f66ba51dcee3f885aaf5cc..981c046730d7dc7c805475fc9c04252ce042c0ce 100644 (file)
@@ -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';
-    }
 }