mirror of
https://github.com/jbcr/core.git
synced 2026-04-26 01:58:15 +02:00
UploadController now only accepts file extensions listed in config.yaml
This commit is contained in:
@@ -173,4 +173,9 @@ class Config
|
||||
{
|
||||
return $this->get('contenttypes/' . $name);
|
||||
}
|
||||
|
||||
public function getFileTypes(): Collection
|
||||
{
|
||||
return new Collection($this->get('general/accept_file_types'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ class UploadController implements AsyncZone
|
||||
$uploadHandler->addRule(
|
||||
'extension',
|
||||
[
|
||||
'allowed' => ['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg', 'pdf'],
|
||||
'allowed' => array_merge($this->config->getMediaTypes()->toArray(), $this->config->getFileTypes()->toArray()),
|
||||
],
|
||||
'{label} should be a valid file (jpg, jpeg, png, webp, svg or pdf)',
|
||||
'Upload file'
|
||||
|
||||
Reference in New Issue
Block a user