Catch node for share not found
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
4bea123c7a
commit
64a38cc2b7
|
@ -33,6 +33,7 @@ use OC\Files\Cache\FailedCache;
|
|||
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;
|
||||
|
||||
/**
|
||||
|
@ -184,17 +185,22 @@ class Cache extends CacheJail {
|
|||
|
||||
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';
|
||||
|
||||
$data = $this->get('');
|
||||
if (preg_match($regex, $data->getName()) === 1) {
|
||||
return [$data];
|
||||
}
|
||||
|
||||
return [];
|
||||
} catch (NotFoundException $e) {
|
||||
// Node for share not found
|
||||
return [];
|
||||
}
|
||||
|
||||
$regex = '/' . str_replace('%', '.*', $pattern) . '/i';
|
||||
|
||||
$data = $this->get('');
|
||||
if (preg_match($regex, $data->getName()) === 1) {
|
||||
return [$data];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue