summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-11-19 09:14:29 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2020-11-19 09:15:02 +0100
commiteab4f3dc76c35326d39569594f3b07f13beca73e (patch)
treea486f897c1e3467e2dc24aebab9c2dfaf68d20d9
parentecbc7f62bee42e526b18248c040444a6d9c29136 (diff)
downloadnextcloud-server-eab4f3dc76c35326d39569594f3b07f13beca73e.tar.gz
nextcloud-server-eab4f3dc76c35326d39569594f3b07f13beca73e.zip
Limit shared cache search if it is just a file
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
-rw-r--r--apps/files_sharing/lib/Cache.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/Cache.php b/apps/files_sharing/lib/Cache.php
index dae33376f6d..c3f31ac3e4f 100644
--- a/apps/files_sharing/lib/Cache.php
+++ b/apps/files_sharing/lib/Cache.php
@@ -177,4 +177,20 @@ class Cache extends CacheJail {
public function clear() {
// Not a valid action for Shared Cache
}
+
+ public function search($pattern) {
+ // Do the normal search on the whole storage for non files
+ if ($this->storage->getItemType() !== 'file') {
+ return parent::search($pattern);
+ }
+
+ $regex = '/' . str_replace('%', '.*', $pattern) . '/i';
+
+ $data = $this->get('');
+ if (preg_match($regex, $data->getName()) === 1) {
+ return [$data];
+ }
+
+ return [];
+ }
}