Merge pull request #24517 from nextcloud/backport/24459/stable20

[stable20] Only execute plain mimetype check for directories and do the fallback…
This commit is contained in:
Roeland Jago Douma 2020-12-03 09:37:44 +01:00 committed by GitHub
commit f6c24133a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -102,8 +102,12 @@ class FileMimeType extends AbstractStringCheck implements IFileCheck {
*/
public function executeCheck($operator, $value) {
$actualValue = $this->getActualValue();
return $this->executeStringCheck($operator, $value, $actualValue) ||
$this->executeStringCheck($operator, $value, $this->mimeTypeDetector->detectPath($this->path));
$plainMimetypeResult = $this->executeStringCheck($operator, $value, $actualValue);
if ($actualValue === 'httpd/unix-directory') {
return $plainMimetypeResult;
}
$detectMimetypeBasedOnFilenameResult = $this->executeStringCheck($operator, $value, $this->mimeTypeDetector->detectPath($this->path));
return $plainMimetypeResult || $detectMimetypeBasedOnFilenameResult;
}
/**