Skip to content

Commit 919a8d4

Browse files
authored
Merge pull request #22646 from nextcloud/bugfix/mimetype-mapping
Fix detecting text/x-php mimetype and secure mimetype mapping
2 parents b4729ce + 16b9817 commit 919a8d4

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

lib/private/Files/Type/Detection.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,14 @@ public function registerTypeArray(array $types): void {
122122
$this->mimetypes = array_merge($this->mimetypes, $types);
123123

124124
// Update the alternative mimetypes to avoid having to look them up each time.
125-
foreach ($this->mimetypes as $mimeType) {
125+
foreach ($this->mimetypes as $extension => $mimeType) {
126+
if (strpos($extension, '_comment') === 0) {
127+
continue;
128+
}
126129
$this->secureMimeTypes[$mimeType[0]] = $mimeType[1] ?? $mimeType[0];
130+
if (isset($mimeType[1])) {
131+
$this->secureMimeTypes[$mimeType[1]] = $mimeType[1];
132+
}
127133
}
128134
}
129135

resources/config/mimetypemapping.dist.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
"pdf": ["application/pdf"],
135135
"pfb": ["application/x-font"],
136136
"pef": ["image/x-dcraw"],
137-
"php": ["application/x-php"],
137+
"php": ["application/x-php", "text/x-php"],
138138
"pl": ["application/x-perl"],
139139
"pls": ["audio/x-scpls"],
140140
"png": ["image/png"],

0 commit comments

Comments
 (0)