mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-22 09:32:14 +00:00
DisabledMimetypes.php validation rule fix
This commit is contained in:
@@ -3,18 +3,8 @@
|
||||
namespace App\Rules;
|
||||
use Illuminate\Contracts\Validation\Rule;
|
||||
|
||||
class MimetypeBlacklistValidation implements Rule
|
||||
class DisabledMimetypes implements Rule
|
||||
{
|
||||
/**
|
||||
* Create a new rule instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the validation rule passes.
|
||||
*
|
||||
@@ -24,10 +14,10 @@ class MimetypeBlacklistValidation implements Rule
|
||||
*/
|
||||
public function passes($attribute, $value)
|
||||
{
|
||||
$mimetype_blacklist = explode(',' ,get_setting('mimetypes_blacklist'));
|
||||
$mimetype_blacklist = explode(',', get_setting('mimetypes_blacklist'));
|
||||
$file_mimetype = explode('/' ,$value->getMimeType());
|
||||
|
||||
return !array_intersect($file_mimetype , $mimetype_blacklist);
|
||||
return ! array_intersect($file_mimetype, $mimetype_blacklist);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,6 +27,6 @@ class MimetypeBlacklistValidation implements Rule
|
||||
*/
|
||||
public function message()
|
||||
{
|
||||
abort (415,'Type of this mime type is not allowed.');
|
||||
return 'Type of this mime type is not allowed.';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user