Merge pull request #8285 from nextcloud/apps_files-smb-catch-exceptions-on-listing
Make SMB module more fault-tolerant
This commit is contained in:
commit
017e1325f1
|
@ -152,7 +152,13 @@ class SMB extends Common implements INotifyStorage {
|
|||
$this->statCache[$path . '/' . $file->getName()] = $file;
|
||||
}
|
||||
return array_filter($files, function (IFileInfo $file) {
|
||||
try {
|
||||
return !$file->isHidden();
|
||||
} catch (ForbiddenException $e) {
|
||||
return false;
|
||||
} catch (NotFoundException $e) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} catch (ConnectException $e) {
|
||||
throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e);
|
||||
|
@ -226,9 +232,13 @@ class SMB extends Common implements INotifyStorage {
|
|||
$highestMTime = 0;
|
||||
$files = $this->share->dir($this->root);
|
||||
foreach ($files as $fileInfo) {
|
||||
try {
|
||||
if ($fileInfo->getMTime() > $highestMTime) {
|
||||
$highestMTime = $fileInfo->getMTime();
|
||||
}
|
||||
} catch (NotFoundException $e) {
|
||||
// Ignore this, can happen on unavailable DFS shares
|
||||
}
|
||||
}
|
||||
return $highestMTime;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue