Merge pull request #23211 from nextcloud/backport/23096/stable20

[stable20] Also check the path based mimetype for flow rule checks
This commit is contained in:
Roeland Jago Douma 2020-10-06 13:07:11 +02:00 committed by GitHub
commit 3bd9297bb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
*/