Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Catch node for share not found
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
  • Loading branch information
skjnldsv committed Apr 2, 2021
commit 64a38cc2b72afbbe0c65795d06e006ba81e50627
24 changes: 15 additions & 9 deletions apps/files_sharing/lib/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use OC\Files\Cache\Wrapper\CacheJail;
use OC\Files\Storage\Wrapper\Jail;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\NotFoundException;
use OCP\Files\StorageNotAvailableException;

/**
Expand Down Expand Up @@ -184,17 +185,22 @@ public function clear() {

public function search($pattern) {
// Do the normal search on the whole storage for non files
if ($this->storage->getItemType() !== 'file') {
return parent::search($pattern);
}
try {
if ($this->storage->getItemType() !== 'file') {
return parent::search($pattern);
}

$regex = '/' . str_replace('%', '.*', $pattern) . '/i';
$regex = '/' . str_replace('%', '.*', $pattern) . '/i';

$data = $this->get('');
if (preg_match($regex, $data->getName()) === 1) {
return [$data];
}
$data = $this->get('');
if (preg_match($regex, $data->getName()) === 1) {
return [$data];
}

return [];
return [];
} catch (NotFoundException $e) {
// Node for share not found
return [];
}
}
}