diff options
author | Robin Appelman <robin@icewind.nl> | 2021-02-15 19:52:11 +0300 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2021-03-05 10:54:09 +0300 |
commit | 326f7ac857748b89909868c86350fa7259201e8b (patch) | |
tree | 94d7df9a829aaf3bafd78765a0518614f0494cb5 /apps | |
parent | b4d001db3a1495cf9a194f6bab2e47a4ec9efd76 (diff) |
catch notfound and forbidden exception in smb::getmetadata
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_external/lib/Lib/Storage/SMB.php | 8 | ||||
-rw-r--r-- | apps/files_sharing/lib/External/Scanner.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/lib/Scanner.php | 2 |
3 files changed, 9 insertions, 3 deletions
diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index ef6ecb6cc74..1b2e12c3115 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -556,7 +556,13 @@ class SMB extends Common implements INotifyStorage { } public function getMetaData($path) { - $fileInfo = $this->getFileInfo($path); + try { + $fileInfo = $this->getFileInfo($path); + } catch (NotFoundException $e) { + return null; + } catch (ForbiddenException $e) { + return null; + } if (!$fileInfo) { return null; } diff --git a/apps/files_sharing/lib/External/Scanner.php b/apps/files_sharing/lib/External/Scanner.php index 0051a1b76bf..b73d7e874a6 100644 --- a/apps/files_sharing/lib/External/Scanner.php +++ b/apps/files_sharing/lib/External/Scanner.php @@ -56,7 +56,7 @@ class Scanner extends \OC\Files\Cache\Scanner { * @param int $parentId * @param array | null $cacheData existing data in the cache for the file to be scanned * @param bool $lock set to false to disable getting an additional read lock during scanning - * @return array an array of metadata of the scanned file + * @return array | null an array of metadata of the scanned file */ public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true, $data = null) { try { diff --git a/apps/files_sharing/lib/Scanner.php b/apps/files_sharing/lib/Scanner.php index 36a412800e5..95b599fe1f3 100644 --- a/apps/files_sharing/lib/Scanner.php +++ b/apps/files_sharing/lib/Scanner.php @@ -45,7 +45,7 @@ class Scanner extends \OC\Files\Cache\Scanner { * * @param string $path path of the file for which to retrieve metadata * - * @return array an array of metadata of the file + * @return array|null an array of metadata of the file */ public function getData($path) { $data = parent::getData($path); |