]> source.dussan.org Git - nextcloud-server.git/commitdiff
Properly add both mimetypes to secure mimetype mapping
authorJulius Härtl <jus@bitgrid.net>
Mon, 7 Sep 2020 14:29:39 +0000 (16:29 +0200)
committerJulius Härtl <jus@bitgrid.net>
Mon, 7 Sep 2020 14:42:11 +0000 (16:42 +0200)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
lib/private/Files/Type/Detection.php

index 6078a5934a65df2dfbb14226556b4f431c3de318..f8cbd2ec725f65e887412048c886556ff031d93c 100644 (file)
@@ -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];
+                       }
                }
        }