From bb4cf2830aca984c001542b3cdc2ebc78bba6941 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 25 Apr 2025 18:35:12 +0200 Subject: fix: better error message when trying to scan a folder that is already being scanned Signed-off-by: Robin Appelman --- apps/files/lib/Command/Scan.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'apps/files/lib') diff --git a/apps/files/lib/Command/Scan.php b/apps/files/lib/Command/Scan.php index 9c57f4b2971..7f45a9ea518 100644 --- a/apps/files/lib/Command/Scan.php +++ b/apps/files/lib/Command/Scan.php @@ -24,6 +24,7 @@ use OCP\Files\NotFoundException; use OCP\Files\StorageNotAvailableException; use OCP\FilesMetadata\IFilesMetadataManager; use OCP\IUserManager; +use OCP\Lock\LockedException; use OCP\Server; use Psr\Log\LoggerInterface; use Symfony\Component\Console\Helper\Table; @@ -165,6 +166,12 @@ class Scan extends Base { } catch (NotFoundException $e) { $output->writeln('Path not found: ' . $e->getMessage() . ''); ++$this->errorsCounter; + } catch (LockedException $e) { + if (str_starts_with($e->getPath(), 'scanner::')) { + $output->writeln('Another process is already scanning \'' . substr($e->getPath(), strlen('scanner::')) . '\''); + } else { + throw $e; + } } catch (\Exception $e) { $output->writeln('Exception during scan: ' . $e->getMessage() . ''); $output->writeln('' . $e->getTraceAsString() . ''); -- cgit v1.2.3