Only execute plain mimetype check for directories and do the fallback only for non-directories

Ref #23096

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
Morris Jobke 2020-11-30 16:43:55 +01:00
parent 3a8bd38ca4
commit c44ec8c5d5
No known key found for this signature in database
GPG Key ID: FE03C3A163FEDE68
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) { public function executeCheck($operator, $value) {
$actualValue = $this->getActualValue(); $actualValue = $this->getActualValue();
return $this->executeStringCheck($operator, $value, $actualValue) || $plainMimetypeResult = $this->executeStringCheck($operator, $value, $actualValue);
$this->executeStringCheck($operator, $value, $this->mimeTypeDetector->detectPath($this->path)); if ($actualValue === 'httpd/unix-directory') {
return $plainMimetypeResult;
}
$detectMimetypeBasedOnFilenameResult = $this->executeStringCheck($operator, $value, $this->mimeTypeDetector->detectPath($this->path));
return $plainMimetypeResult || $detectMimetypeBasedOnFilenameResult;
} }
/** /**