X Tutup
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion apps/files/lib/Command/VerifyChecksums.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use OCP\Files\Node;
use OCP\Files\NotFoundException;
use OCP\Files\Storage\IStorage;
use OCP\Files\StorageNotAvailableException;
use OCP\IUser;
use OCP\IUserManager;
use Symfony\Component\Console\Command\Command;
Expand Down Expand Up @@ -200,11 +201,19 @@ private function verifyChecksumsForFile($file, InputInterface $input, OutputInte
private function verifyChecksumsForFolder($folder, InputInterface $input, OutputInterface $output) {
$folderQueue = [$folder];
while ($currentFolder = \array_pop($folderQueue)) {
'@phan-var \OCP\Files\Folder $currentFolder';
$currentFolderPath = $currentFolder->getPath();
try {
'@phan-var \OCP\Files\Folder $currentFolder';
$nodes = $currentFolder->getDirectoryListing();
} catch (NotFoundException $e) {
$nodes = [];
$output->writeln("Skipping $currentFolderPath => Directory could not be found");
} catch (StorageNotAvailableException $e) {
$nodes = [];
$output->writeln("Skipping $currentFolderPath => Storage is not available");
} catch (\Exception $e) {
$nodes = [];
$output->writeln("Skipping $currentFolderPath => " . $e->getMessage());
}
foreach ($nodes as $node) {
if ($node->getType() === FileInfo::TYPE_FOLDER) {
Expand Down
7 changes: 7 additions & 0 deletions changelog/unreleased/38785
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: Prevent files:checksum:verify from crashing on exception

The command now skips files with exceptions instead of crashing.
A proper message will be displayed to the user who fires the command.

https://github.com/owncloud/core/pull/38785
https://github.com/owncloud/core/issues/38782
X Tutup