Skip to content

Commit 7591a94

Browse files
authored
Merge pull request #22746 from nextcloud/backport/22646/stable18
[stable18] Fix detecting text/x-php mimetype and secure mimetype mapping
2 parents c97df0f + 4b3d5fe commit 7591a94

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/private/Files/Type/Detection.php

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

122122
// Update the alternative mimetypes to avoid having to look them up each time.
123-
foreach ($this->mimetypes as $mimeType) {
123+
foreach ($this->mimetypes as $extension => $mimeType) {
124+
if (strpos($extension, '_comment') === 0) {
125+
continue;
126+
}
124127
$this->secureMimeTypes[$mimeType[0]] = $mimeType[1] ?? $mimeType[0];
128+
if (isset($mimeType[1])) {
129+
$this->secureMimeTypes[$mimeType[1]] = $mimeType[1];
130+
}
125131
}
126132
}
127133

resources/config/mimetypemapping.dist.json

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

0 commit comments

Comments
 (0)