summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-01-09 18:37:29 +0100
committerGitHub <noreply@github.com>2022-01-09 18:37:29 +0100
commit9824104de5532fc2f1b71f7afdc1efd827bd1117 (patch)
treec6485a3d3c645ac18ee2bea0b468d3ef60c381b3 /apps
parent74bfe61a496433b61d58155d38b9843338ca0c55 (diff)
parent0b15da3c250c0d430ff84cc973ac647a537a85e2 (diff)
downloadnextcloud-server-9824104de5532fc2f1b71f7afdc1efd827bd1117.tar.gz
nextcloud-server-9824104de5532fc2f1b71f7afdc1efd827bd1117.zip
Merge pull request #30468 from nextcloud/fix/handle-server-unavailable-scanner
Handle LocalServerException when scanning external shares
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/lib/External/Scanner.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/apps/files_sharing/lib/External/Scanner.php b/apps/files_sharing/lib/External/Scanner.php
index 54d5a33d517..cfde56103da 100644
--- a/apps/files_sharing/lib/External/Scanner.php
+++ b/apps/files_sharing/lib/External/Scanner.php
@@ -29,6 +29,8 @@ use OC\ForbiddenException;
use OCP\Files\NotFoundException;
use OCP\Files\StorageInvalidException;
use OCP\Files\StorageNotAvailableException;
+use OCP\Http\Client\LocalServerException;
+use Psr\Log\LoggerInterface;
class Scanner extends \OC\Files\Cache\Scanner {
/** @var \OCA\Files_Sharing\External\Storage */
@@ -36,8 +38,15 @@ class Scanner extends \OC\Files\Cache\Scanner {
/** {@inheritDoc} */
public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) {
- if (!$this->storage->remoteIsOwnCloud()) {
- return parent::scan($path, $recursive, $reuse, $lock);
+ try {
+ if (!$this->storage->remoteIsOwnCloud()) {
+ return parent::scan($path, $recursive, $reuse, $lock);
+ }
+ } catch (LocalServerException $e) {
+ // Scanner doesn't have dependency injection
+ \OC::$server->get(LoggerInterface::class)
+ ->warning('Trying to scan files inside invalid external storage: ' . $this->storage->getRemote() . ' for mountpoint ' . $this->storage->getMountPoint() . ' and id ' . $this->storage->getId());
+ return;
}
$this->scanAll();