From 554fab45aa9497b5c74c9c57945696d896e856a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 7 Sep 2020 16:29:39 +0200 Subject: [PATCH 1/2] 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(-) diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php index e882503766..64a7701011 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]; + } } } From 2c8bea4b1d3d4cb253ab2a0feab6f75f6082bed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 7 Sep 2020 16:43:00 +0200 Subject: [PATCH 2/2] Add text/x-php as an alternative for application/x-php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- resources/config/mimetypemapping.dist.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/config/mimetypemapping.dist.json b/resources/config/mimetypemapping.dist.json index c59dfaefd3..97b2f74ff0 100644 --- a/resources/config/mimetypemapping.dist.json +++ b/resources/config/mimetypemapping.dist.json @@ -134,7 +134,7 @@ "pdf": ["application/pdf"], "pfb": ["application/x-font"], "pef": ["image/x-dcraw"], - "php": ["application/x-php"], + "php": ["application/x-php", "text/x-php"], "pl": ["application/x-perl"], "pls": ["audio/x-scpls"], "png": ["image/png"],