Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-11-19 11:14:29 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2020-11-20 10:27:47 +0300
commit37df208bd778c223bfb47798e97fe35b0c1139bf (patch)
treeff2e4e3e7812c428800b9357fcc035909c5f1785 /apps/files_sharing/lib
parent78b62b6b65b239559bd7eff4e21cd84a790ac4e2 (diff)
Limit shared cache search if it is just a file
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/files_sharing/lib')
-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 [];
+ }
}