diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2023-10-10 10:02:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-10 10:02:33 +0200 |
commit | 0856cecb4fb929080c7e481d8cc05b7b83207514 (patch) | |
tree | 3494ec80871dd8d0179a041e2f3bcf54b173f2b5 /apps | |
parent | 7fc9b23f28236ea0b947edada69ae3dc94d1c345 (diff) | |
parent | a521973c593c7868459d0f5f5c1055e66d519bfd (diff) | |
download | nextcloud-server-0856cecb4fb929080c7e481d8cc05b7b83207514.tar.gz nextcloud-server-0856cecb4fb929080c7e481d8cc05b7b83207514.zip |
Merge pull request #40383 from nextcloud/backport/36830/stable27
[stable27] fix: Avoid failing with duplicate checks
Diffstat (limited to 'apps')
-rw-r--r-- | apps/workflowengine/lib/Check/FileMimeType.php | 8 | ||||
-rw-r--r-- | apps/workflowengine/tests/Check/FileMimeTypeTest.php | 6 |
2 files changed, 4 insertions, 10 deletions
diff --git a/apps/workflowengine/lib/Check/FileMimeType.php b/apps/workflowengine/lib/Check/FileMimeType.php index 991d7ebc739..dfcfed9466b 100644 --- a/apps/workflowengine/lib/Check/FileMimeType.php +++ b/apps/workflowengine/lib/Check/FileMimeType.php @@ -107,13 +107,7 @@ class FileMimeType extends AbstractStringCheck implements IFileCheck { * @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()); } /** diff --git a/apps/workflowengine/tests/Check/FileMimeTypeTest.php b/apps/workflowengine/tests/Check/FileMimeTypeTest.php index 3ebcaa8f4b3..e5a4c99269f 100644 --- a/apps/workflowengine/tests/Check/FileMimeTypeTest.php +++ b/apps/workflowengine/tests/Check/FileMimeTypeTest.php @@ -127,7 +127,7 @@ class FileMimeTypeTest extends TestCase { $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() { @@ -142,7 +142,7 @@ class FileMimeTypeTest extends TestCase { 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); @@ -156,7 +156,7 @@ class FileMimeTypeTest extends TestCase { $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() { |