mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-31 04:55:50 +08:00
Prevent dbl exts. on img upload, Randomized attachment upload names
This commit is contained in:
@ -28,6 +28,11 @@ class AppServiceProvider extends ServiceProvider
|
||||
return in_array(strtolower($value->getClientOriginalExtension()), $validImageExtensions);
|
||||
});
|
||||
|
||||
Validator::extend('no_double_extension', function ($attribute, $value, $parameters, $validator) {
|
||||
$uploadName = $value->getClientOriginalName();
|
||||
return substr_count($uploadName, '.') < 2;
|
||||
});
|
||||
|
||||
|
||||
// Custom blade view directives
|
||||
Blade::directive('icon', function ($expression) {
|
||||
|
Reference in New Issue
Block a user