From: Julius Härtl Date: Mon, 7 Sep 2020 14:29:39 +0000 (+0200) Subject: Properly add both mimetypes to secure mimetype mapping X-Git-Tag: v20.0.0beta4~36^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5e4303b1fe19d3effdf003a44a2f679bec67340a;p=nextcloud-server.git Properly add both mimetypes to secure mimetype mapping Signed-off-by: Julius Härtl --- diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php index 6078a5934a6..f8cbd2ec725 100644 --- a/lib/private/Files/Type/Detection.php +++ b/lib/private/Files/Type/Detection.php @@ -122,8 +122,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]; + } } }