diff options
author | Morris Jobke <hey@morrisjobke.de> | 2020-11-19 23:18:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-19 23:18:48 +0100 |
commit | 700449882ab3c7d0c5c6f91befe95ab1b60491a9 (patch) | |
tree | 142d2a2a29d0a44291ae5a3c2679411cba14bcb5 /apps/files_sharing/lib | |
parent | 568762a5a5728bec0aff505a5f6dd7910482fbe1 (diff) | |
parent | eab4f3dc76c35326d39569594f3b07f13beca73e (diff) | |
download | nextcloud-server-700449882ab3c7d0c5c6f91befe95ab1b60491a9.tar.gz nextcloud-server-700449882ab3c7d0c5c6f91befe95ab1b60491a9.zip |
Merge pull request #24203 from nextcloud/enh/search_regex_file_shares
Use regex when searching on single file shares
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r-- | apps/files_sharing/lib/Cache.php | 16 |
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 []; + } } |