summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/lib/Cache.php22
-rw-r--r--apps/files_trashbin/lib/Trashbin.php5
2 files changed, 13 insertions, 14 deletions
diff --git a/apps/files_sharing/lib/Cache.php b/apps/files_sharing/lib/Cache.php
index 29224c5fb6b..b703a672a25 100644
--- a/apps/files_sharing/lib/Cache.php
+++ b/apps/files_sharing/lib/Cache.php
@@ -31,6 +31,7 @@ namespace OCA\Files_Sharing;
use OC\Files\Cache\FailedCache;
use OC\Files\Cache\Wrapper\CacheJail;
use OC\Files\Storage\Wrapper\Jail;
+use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\StorageNotAvailableException;
@@ -181,19 +182,18 @@ class Cache extends CacheJail {
// Not a valid action for Shared Cache
}
- public function search($pattern) {
- // Do the normal search on the whole storage for non files
+ public function getQueryFilterForStorage(IQueryBuilder $builder) {
+ // Do the normal jail behavior for non files
if ($this->storage->getItemType() !== 'file') {
- return parent::search($pattern);
+ return parent::getQueryFilterForStorage($builder);
}
- $regex = '/' . str_replace('%', '.*', $pattern) . '/i';
-
- $data = $this->get('');
- if (preg_match($regex, $data->getName()) === 1) {
- return [$data];
- }
-
- return [];
+ // for single file shares we don't need to do the LIKE
+ return $builder->expr()->andX(
+ parent::getQueryFilterForStorage($builder),
+ $builder->expr()->orX(
+ $builder->expr()->eq('path_hash', $builder->createNamedParameter(md5($this->getGetUnjailedRoot()))),
+ )
+ );
}
}
diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php
index 1cef0a6ed0a..0e16c56ed8d 100644
--- a/apps/files_trashbin/lib/Trashbin.php
+++ b/apps/files_trashbin/lib/Trashbin.php
@@ -988,8 +988,7 @@ class Trashbin {
$query = new CacheQueryBuilder(
\OC::$server->getDatabaseConnection(),
\OC::$server->getSystemConfig(),
- \OC::$server->getLogger(),
- $cache
+ \OC::$server->getLogger()
);
$normalizedParentPath = ltrim(Filesystem::normalizePath(dirname('files_trashbin/versions/'. $filename)), '/');
$parentId = $cache->getId($normalizedParentPath);
@@ -998,7 +997,7 @@ class Trashbin {
}
$query->selectFileCache()
- ->whereStorageId()
+ ->whereStorageId($cache->getNumericStorageId())
->andWhere($query->expr()->eq('parent', $query->createNamedParameter($parentId)))
->andWhere($query->expr()->iLike('name', $query->createNamedParameter($pattern)));