Convert file extension to lower case

This commit is contained in:
Visman 2023-07-12 15:36:13 +07:00
parent 62b335542e
commit e928df83da
2 changed files with 3 additions and 3 deletions

View file

@ -1144,7 +1144,7 @@ class Files
$ext = '';
} else {
$name = \substr($file['name'], 0, $pos);
$ext = \substr($file['name'], $pos + 1);
$ext = \mb_strtolower(\substr($file['name'], $pos + 1), 'UTF-8');
}
$imageExt = $this->imageExt($file['tmp_name']);

View file

@ -330,7 +330,7 @@ class Groups extends Admin
*/
public function vExtsCheck(Validator $v, string $exts): string
{
$exts = \explode(',', $exts);
$exts = \explode(',', \mb_strtolower($exts, 'UTF-8'));
$result = [];
foreach ($exts as $ext) {
@ -340,7 +340,7 @@ class Groups extends Admin
\preg_match('%^[a-z0-9]+(?:[_-]+[a-z0-9]+)*$%iD', $ext)
&& ! \preg_match($this->c->attachments::BAD_EXTS, $ext)
) {
$result[] = $ext;
$result[$ext] = $ext;
}
}