mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-19 03:04:05 +00:00
@@ -32,11 +32,18 @@ class Base64Mime implements Rule
|
||||
$this->attribute = $attribute;
|
||||
|
||||
try {
|
||||
$data = json_decode($value)->data;
|
||||
$decoded = json_decode(trim($value));
|
||||
$name = !empty($decoded->name) ? $decoded->name : '';
|
||||
$data = !empty($decoded->data) ? $decoded->data : '';
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$extension = pathinfo($name, PATHINFO_EXTENSION);
|
||||
if(!in_array($extension, $this->extensions)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$pattern = '/^data:\w+\/[\w\+]+;base64,[\w\+\=\/]+$/';
|
||||
|
||||
if (! preg_match($pattern, $data)) {
|
||||
|
||||
Reference in New Issue
Block a user