From e2aa283dbab472c95c20e2b10b1365f9459b0100 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 26 Jan 2022 17:42:48 +0100 Subject: handle notfound and notpermitted error in Smb::getDirectoryContent Signed-off-by: Robin Appelman --- apps/files_external/lib/Lib/Storage/SMB.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'apps/files_external/lib/Lib/Storage/SMB.php') diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index 28a2d6de7cc..81ee39d20e2 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -620,9 +620,15 @@ class SMB extends Common implements INotifyStorage { } public function getDirectoryContent($directory): \Traversable { - $files = $this->getFolderContents($directory); - foreach ($files as $file) { - yield $this->getMetaDataFromFileInfo($file); + try { + $files = $this->getFolderContents($directory); + foreach ($files as $file) { + yield $this->getMetaDataFromFileInfo($file); + } + } catch (NotFoundException $e) { + return; + } catch (NotPermittedException $e) { + return; } } -- cgit v1.2.3