Skip to content

Commit 6b98b9f

Browse files
committed
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>
1 parent 7d06027 commit 6b98b9f

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

apps/workflowengine/lib/Check/FileMimeType.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,18 @@ protected function cacheAndReturnMimeType(string $storageId, ?string $path, stri
9393
return $mimeType;
9494
}
9595

96+
/**
97+
* Make sure that even though the content based check returns an application/octet-stream can still be checked based on mimetypemappings of their extension
98+
* @param string $operator
99+
* @param string $value
100+
* @return bool
101+
*/
102+
public function executeCheck($operator, $value) {
103+
$actualValue = $this->getActualValue();
104+
return $this->executeStringCheck($operator, $value, $actualValue) ||
105+
($actualValue === 'application/octet-stream' && $this->executeStringCheck($operator, $value, $this->mimeTypeDetector->detectPath($this->path)));
106+
}
107+
96108
/**
97109
* @return string
98110
*/

0 commit comments

Comments
 (0)