Make sure to check the mimetype on the path if a secure one could not be detemined though the content

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2020-09-29 15:52:48 +02:00 committed by backportbot[bot]
parent 20524cff33
commit 53ac186473
1 changed files with 13 additions and 0 deletions

View File

@ -93,6 +93,19 @@ class FileMimeType extends AbstractStringCheck implements IFileCheck {
return $mimeType;
}
/**
* Make sure that even though the content based check returns an application/octet-stream can still be checked based on mimetypemappings of their extension
*
* @param string $operator
* @param string $value
* @return bool
*/
public function executeCheck($operator, $value) {
$actualValue = $this->getActualValue();
return $this->executeStringCheck($operator, $value, $actualValue) ||
$this->executeStringCheck($operator, $value, $this->mimeTypeDetector->detectPath($this->path));
}
/**
* @return string
*/