-
app/Providers/CustomValidationServiceProvider.php
Open in GitHubuse BookStack\Uploads\ImageService; use Illuminate\Support\Facades\Validator; use Illuminate\Support\ServiceProvider; class CustomValidationServiceProvider extends ServiceProvider { public function boot(): void { Validator::extend('image_extension', function ($attribute, $value, $parameters, $validator) { $extension = strtolower($value->getClientOriginalExtension()); return ImageService::isExtensionSupported($extension); }); Validator::extend('safe_url', function ($attribute, $value, $parameters, $validator) { $cleanLinkName = strtolower(trim($value)); $isJs = strpos($cleanLinkName, 'javascript:') === 0; $isData = strpos($cleanLinkName, 'data:') === 0; return !$isJs && !$isData; }); } }
-
app/Config/app.php
Open in GitHubreturn [ // 'providers' => [ // BookStack\Providers\CustomValidationServiceProvider::class, ], // ];