diff options
author | Vincent Petry <vincent@nextcloud.com> | 2021-08-24 08:59:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-24 08:59:35 +0200 |
commit | e32d2933462a6125481e5e546bd5f237602db09e (patch) | |
tree | 6842e1e3dc3a8a33c0fdb9d7efda5171a6c7a11c | |
parent | 6702c2b356ffffd64c952b2ef8493a9f2408ba42 (diff) | |
parent | c48f9ffcdd83fb641a6433bc0543f3f90fbd08c4 (diff) | |
download | nextcloud-server-e32d2933462a6125481e5e546bd5f237602db09e.tar.gz nextcloud-server-e32d2933462a6125481e5e546bd5f237602db09e.zip |
Merge pull request #28476 from nextcloud/search-jail-insensitive
use case insensitive like when limiting search to jail
-rw-r--r-- | lib/private/Files/Cache/SearchBuilder.php | 6 | ||||
-rw-r--r-- | lib/private/Files/Cache/Wrapper/CacheJail.php | 2 | ||||
-rw-r--r-- | lib/public/Files/Search/ISearchComparison.php | 1 |
3 files changed, 6 insertions, 3 deletions
diff --git a/lib/private/Files/Cache/SearchBuilder.php b/lib/private/Files/Cache/SearchBuilder.php index 7e1fbe08492..be38e5622bf 100644 --- a/lib/private/Files/Cache/SearchBuilder.php +++ b/lib/private/Files/Cache/SearchBuilder.php @@ -39,6 +39,7 @@ use OCP\Files\Search\ISearchOrder; class SearchBuilder { protected static $searchOperatorMap = [ ISearchComparison::COMPARE_LIKE => 'iLike', + ISearchComparison::COMPARE_LIKE_CASE_SENSITIVE => 'like', ISearchComparison::COMPARE_EQUAL => 'eq', ISearchComparison::COMPARE_GREATER_THAN => 'gt', ISearchComparison::COMPARE_GREATER_THAN_EQUAL => 'gte', @@ -48,6 +49,7 @@ class SearchBuilder { protected static $searchOperatorNegativeMap = [ ISearchComparison::COMPARE_LIKE => 'notLike', + ISearchComparison::COMPARE_LIKE_CASE_SENSITIVE => 'notLike', ISearchComparison::COMPARE_EQUAL => 'neq', ISearchComparison::COMPARE_GREATER_THAN => 'lte', ISearchComparison::COMPARE_GREATER_THAN_EQUAL => 'lt', @@ -186,8 +188,8 @@ class SearchBuilder { $comparisons = [ 'mimetype' => ['eq', 'like'], 'mtime' => ['eq', 'gt', 'lt', 'gte', 'lte'], - 'name' => ['eq', 'like'], - 'path' => ['eq', 'like'], + 'name' => ['eq', 'like', 'clike'], + 'path' => ['eq', 'like', 'clike'], 'size' => ['eq', 'gt', 'lt', 'gte', 'lte'], 'tagname' => ['eq', 'like'], 'favorite' => ['eq'], diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php index d0fb43c10be..540b6f7b8c3 100644 --- a/lib/private/Files/Cache/Wrapper/CacheJail.php +++ b/lib/private/Files/Cache/Wrapper/CacheJail.php @@ -313,7 +313,7 @@ class CacheJail extends CacheWrapper { new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', $this->getGetUnjailedRoot()), - new SearchComparison(ISearchComparison::COMPARE_LIKE, 'path', $this->getGetUnjailedRoot() . '/%'), + new SearchComparison(ISearchComparison::COMPARE_LIKE_CASE_SENSITIVE, 'path', $this->getGetUnjailedRoot() . '/%'), ], ) ] diff --git a/lib/public/Files/Search/ISearchComparison.php b/lib/public/Files/Search/ISearchComparison.php index 174da8bc566..36d10824653 100644 --- a/lib/public/Files/Search/ISearchComparison.php +++ b/lib/public/Files/Search/ISearchComparison.php @@ -33,6 +33,7 @@ interface ISearchComparison extends ISearchOperator { public const COMPARE_LESS_THAN = 'lt'; public const COMPARE_LESS_THAN_EQUAL = 'lte'; public const COMPARE_LIKE = 'like'; + public const COMPARE_LIKE_CASE_SENSITIVE = 'clike'; /** * Get the type of comparison, one of the ISearchComparison::COMPARE_* constants |