From a3358c0e655eed9419c4e870bfefe73ba974b570 Mon Sep 17 00:00:00 2001 From: Fabien Basmaison Date: Wed, 23 Oct 2019 22:48:06 +0200 Subject: [PATCH] Fix `accept` for SVG files in `file` uploaders: (#1732) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using `accept: 'image/svg+xml' to only allow SVG file to be uploaded should now work. The `preg_match` was comparing `svgggg…xml` with `svg+xml`. Check the [List of Media Types](https://www.iana.org/assignments/media-types/media-types.xhtml#image) for more potential issues. --- classes/adminbasecontroller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/adminbasecontroller.php b/classes/adminbasecontroller.php index 3747dd28..392f0a8b 100644 --- a/classes/adminbasecontroller.php +++ b/classes/adminbasecontroller.php @@ -325,7 +325,7 @@ class AdminBaseController } $isMime = strstr($type, '/'); - $find = str_replace(['.', '*'], ['\.', '.*'], $type); + $find = str_replace(['.', '*', '+'], ['\.', '.*', '\+'], $type); if ($isMime) { $match = preg_match('#' . $find . '$#', $mime);