summaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2018-02-27 13:10:54 +0100
committerGitHub <noreply@github.com>2018-02-27 13:10:54 +0100
commit017e1325f14d3cdbf8d16326f47d1aefa7eac4ea (patch)
tree5755c1901a76b1e4dbd96eed95f6526098eb16a0 /apps/files_external
parent048ad0df1d1e64fd3e6da664e269b61447c7d570 (diff)
parent8e251e5d5a3dcb220387208768a8e124dbafe0a1 (diff)
downloadnextcloud-server-017e1325f14d3cdbf8d16326f47d1aefa7eac4ea.tar.gz
nextcloud-server-017e1325f14d3cdbf8d16326f47d1aefa7eac4ea.zip
Merge pull request #8285 from nextcloud/apps_files-smb-catch-exceptions-on-listing
Make SMB module more fault-tolerant
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/lib/Lib/Storage/SMB.php16
1 files changed, 13 insertions, 3 deletions
diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php
index 58a6f65990f..f8fd37a4d48 100644
--- a/apps/files_external/lib/Lib/Storage/SMB.php
+++ b/apps/files_external/lib/Lib/Storage/SMB.php
@@ -152,7 +152,13 @@ class SMB extends Common implements INotifyStorage {
$this->statCache[$path . '/' . $file->getName()] = $file;
}
return array_filter($files, function (IFileInfo $file) {
- return !$file->isHidden();
+ 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,8 +232,12 @@ class SMB extends Common implements INotifyStorage {
$highestMTime = 0;
$files = $this->share->dir($this->root);
foreach ($files as $fileInfo) {
- if ($fileInfo->getMTime() > $highestMTime) {
- $highestMTime = $fileInfo->getMTime();
+ try {
+ if ($fileInfo->getMTime() > $highestMTime) {
+ $highestMTime = $fileInfo->getMTime();
+ }
+ } catch (NotFoundException $e) {
+ // Ignore this, can happen on unavailable DFS shares
}
}
return $highestMTime;