From 9e3bdcd63c037e0104f2a5bcb0f30ff0f4a88c75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 29 Sep 2020 15:52:48 +0200 Subject: [PATCH] Make sure to check the mimetype on the path if a secure one could not be detemined though the content MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/workflowengine/lib/Check/FileMimeType.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/apps/workflowengine/lib/Check/FileMimeType.php b/apps/workflowengine/lib/Check/FileMimeType.php index 0e02c40512..4e61e5693b 100644 --- a/apps/workflowengine/lib/Check/FileMimeType.php +++ b/apps/workflowengine/lib/Check/FileMimeType.php @@ -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 */