Skip to content

Commit

Permalink
Limit shared cache search if it is just a file
Browse files Browse the repository at this point in the history
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
  • Loading branch information
rullzer authored and backportbot[bot] committed Nov 20, 2020
1 parent 78b62b6 commit 37df208
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions apps/files_sharing/lib/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,20 @@ private function getOwnerDisplayName() {
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 [];
}
}

0 comments on commit 37df208

Please sign in to comment.