diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index 28a2d6de7cc27..81ee39d20e240 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -620,9 +620,15 @@ public function opendir($path) { } 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; } }