diff options
author | Robin Appelman <robin@icewind.nl> | 2023-04-05 21:36:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-05 21:36:21 +0200 |
commit | 03e965a513accef64015ac307f4a0784f2ffc52d (patch) | |
tree | f175d8780af19851546805d20baa229b8061bb1d /lib | |
parent | 72fce81c0c128de3763d15d3431429d7b8bbb18a (diff) | |
parent | b1f352c6149043d14256d6620d8b911eb28afae8 (diff) | |
download | nextcloud-server-03e965a513accef64015ac307f4a0784f2ffc52d.tar.gz nextcloud-server-03e965a513accef64015ac307f4a0784f2ffc52d.zip |
Merge pull request #22943 from nextcloud/scanner-no-access-handling
improve handling of files we can't access in the scanner
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/Cache/Scanner.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index f7d1d105d83..910b18b3e98 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -38,6 +38,7 @@ namespace OC\Files\Cache; use Doctrine\DBAL\Exception; use OCP\Files\Cache\IScanner; use OCP\Files\ForbiddenException; +use OCP\Files\NotFoundException; use OCP\Files\Storage\IReliableEtagStorage; use OCP\Lock\ILockingProvider; use OC\Files\Storage\Wrapper\Encoding; @@ -219,7 +220,7 @@ class Scanner extends BasicEmitter implements IScanner { $newData['parent'] = $parentId; $data['fileid'] = $this->addToCache($file, $newData, $fileId); } - + $data['oldSize'] = ($cacheData && isset($cacheData['size'])) ? $cacheData['size'] : 0; if ($cacheData && isset($cacheData['encrypted'])) { @@ -328,10 +329,15 @@ class Scanner extends BasicEmitter implements IScanner { } } try { - $data = $this->scanFile($path, $reuse, -1, null, $lock); - if ($data && $data['mimetype'] === 'httpd/unix-directory') { - $size = $this->scanChildren($path, $recursive, $reuse, $data['fileid'], $lock, $data); - $data['size'] = $size; + try { + $data = $this->scanFile($path, $reuse, -1, null, $lock); + if ($data && $data['mimetype'] === 'httpd/unix-directory') { + $size = $this->scanChildren($path, $recursive, $reuse, $data['fileid'], $lock, $data); + $data['size'] = $size; + } + } catch (NotFoundException $e) { + $this->removeFromCache($path); + return null; } } finally { if ($lock) { |