From b3c5271c89b6120b0407484895e8f975958d33c7 Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Mon, 7 Sep 2020 16:29:39 +0200 Subject: Properly add both mimetypes to secure mimetype mapping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/private/Files/Type/Detection.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php index 1352963fc67..4e7f89778a4 100644 --- a/lib/private/Files/Type/Detection.php +++ b/lib/private/Files/Type/Detection.php @@ -120,8 +120,14 @@ class Detection implements IMimeTypeDetector { $this->mimetypes = array_merge($this->mimetypes, $types); // Update the alternative mimetypes to avoid having to look them up each time. - foreach ($this->mimetypes as $mimeType) { + foreach ($this->mimetypes as $extension => $mimeType) { + if (strpos($extension, '_comment') === 0) { + continue; + } $this->secureMimeTypes[$mimeType[0]] = $mimeType[1] ?? $mimeType[0]; + if (isset($mimeType[1])) { + $this->secureMimeTypes[$mimeType[1]] = $mimeType[1]; + } } } -- cgit v1.2.3