diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2019-10-29 11:17:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-29 11:17:05 +0100 |
commit | 7c207d002a858a09808b0b1294243355ee91493b (patch) | |
tree | ec8a306c46426078f58e76e481ad67bbebd230d8 | |
parent | a7de52e9d9574396c73694ffccd3176bb5aacf05 (diff) | |
parent | 3ce9f0013af721ad1f57d35a2e9bf97ea0135d0c (diff) | |
download | nextcloud-server-7c207d002a858a09808b0b1294243355ee91493b.tar.gz nextcloud-server-7c207d002a858a09808b0b1294243355ee91493b.zip |
Merge pull request #17732 from nextcloud/backport/17730/stable16
[stable16] Fix DAV mimetype search
-rw-r--r-- | lib/private/Files/Cache/QuerySearchHelper.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/private/Files/Cache/QuerySearchHelper.php b/lib/private/Files/Cache/QuerySearchHelper.php index ac64ba5c592..2d9d8f374f7 100644 --- a/lib/private/Files/Cache/QuerySearchHelper.php +++ b/lib/private/Files/Cache/QuerySearchHelper.php @@ -136,16 +136,19 @@ class QuerySearchHelper { $type = $operator->getType(); if ($field === 'mimetype') { if ($operator->getType() === ISearchComparison::COMPARE_EQUAL) { - $value = $this->mimetypeLoader->getId($value); + $value = (int)$this->mimetypeLoader->getId($value); } else if ($operator->getType() === ISearchComparison::COMPARE_LIKE) { // transform "mimetype='foo/%'" to "mimepart='foo'" if (preg_match('|(.+)/%|', $value, $matches)) { $field = 'mimepart'; - $value = $this->mimetypeLoader->getId($matches[1]); + $value = (int)$this->mimetypeLoader->getId($matches[1]); $type = ISearchComparison::COMPARE_EQUAL; - } - if (strpos($value, '%') !== false) { + } else if (strpos($value, '%') !== false) { throw new \InvalidArgumentException('Unsupported query value for mimetype: ' . $value . ', only values in the format "mime/type" or "mime/%" are supported'); + } else { + $field = 'mimetype'; + $value = (int)$this->mimetypeLoader->getId($value); + $type = ISearchComparison::COMPARE_EQUAL; } } } else if ($field === 'favorite') { |