Skip to content

Commit

Permalink
Merge pull request #30557 from nextcloud/backport/30468/stable23
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Jan 10, 2022
2 parents 99b400c + b054321 commit ed1fcf1
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions apps/files_sharing/lib/External/Scanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,24 @@
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 */
protected $storage;

/** {@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();
Expand Down

0 comments on commit ed1fcf1

Please sign in to comment.