Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions apps/workflowengine/lib/Check/FileMimeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,7 @@ protected function cacheAndReturnMimeType(string $storageId, ?string $path, stri
* @return bool
*/
public function executeCheck($operator, $value) {
$actualValue = $this->getActualValue();
$plainMimetypeResult = $this->executeStringCheck($operator, $value, $actualValue);
if ($actualValue === 'httpd/unix-directory') {
return $plainMimetypeResult;
}
$detectMimetypeBasedOnFilenameResult = $this->executeStringCheck($operator, $value, $this->mimeTypeDetector->detectPath($this->path));
return $plainMimetypeResult || $detectMimetypeBasedOnFilenameResult;
return $this->executeStringCheck($operator, $value, $this->getActualValue());
}

/**
Expand Down
6 changes: 3 additions & 3 deletions apps/workflowengine/tests/Check/FileMimeTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function testNonCachedNotLocal() {
$check = new FileMimeType($this->l10n, $this->request, $this->mimeDetector);
$check->setFileInfo($storage, 'foo/bar.txt');

$this->assertTrue($check->executeCheck('is', 'text/plain-path-detected'));
$this->assertTrue($check->executeCheck('is', 'text/plain-content-detected'));
}

public function testFallback() {
Expand All @@ -142,7 +142,7 @@ public function testFallback() {
public function testFromCacheCached() {
$storage = new Temporary([]);
$storage->mkdir('foo');
$storage->file_put_contents('foo/bar.txt', 'asd');
$storage->file_put_contents('foo/bar.txt', 'text-content');
$storage->getScanner()->scan('');

$check = new FileMimeType($this->l10n, $this->request, $this->mimeDetector);
Expand All @@ -156,7 +156,7 @@ public function testFromCacheCached() {

$newCheck = new FileMimeType($this->l10n, $this->request, $this->mimeDetector);
$newCheck->setFileInfo($storage, 'foo/bar.txt');
$this->assertTrue($newCheck->executeCheck('is', 'text/plain-path-detected'));
$this->assertTrue($newCheck->executeCheck('is', 'text/plain-content-detected'));
}

public function testExistsCached() {
Expand Down