diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-01-29 11:26:19 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2021-01-29 11:26:22 +0100 |
commit | e9ae943bbaeda07724dd52cb238caad015504a6f (patch) | |
tree | a6d2286eaf3da9db6ca5b7da214571ca3b148714 /apps/files_external | |
parent | 6a3321cefeacb977e2832e26e28d72a6223d6b48 (diff) | |
download | nextcloud-server-e9ae943bbaeda07724dd52cb238caad015504a6f.tar.gz nextcloud-server-e9ae943bbaeda07724dd52cb238caad015504a6f.zip |
Properly handle SMB ACL blocking scanning a directory
This makes sure that a possible ForbiddenException is properly passed
through the storage as a ForbiddenException and can be catched when
trying to fetch the quota info of a parent folder
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/files_external')
-rw-r--r-- | apps/files_external/lib/Lib/Storage/SMB.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index 0f67877d148..952f6c08931 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -61,6 +61,7 @@ use OCP\Constants; use OCP\Files\EntityTooLargeException; use OCP\Files\Notify\IChange; use OCP\Files\Notify\IRenameChange; +use OCP\Files\NotPermittedException; use OCP\Files\Storage\INotifyStorage; use OCP\Files\StorageAuthException; use OCP\Files\StorageNotAvailableException; @@ -235,7 +236,11 @@ class SMB extends Common implements INotifyStorage { protected function getFolderContents($path): iterable { try { $path = ltrim($this->buildPath($path), '/'); - $files = $this->share->dir($path); + try { + $files = $this->share->dir($path); + } catch (ForbiddenException $e) { + throw new NotPermittedException(); + } foreach ($files as $file) { $this->statCache[$path . '/' . $file->getName()] = $file; } @@ -595,7 +600,7 @@ class SMB extends Common implements INotifyStorage { $files = $this->getFolderContents($path); } catch (NotFoundException $e) { return false; - } catch (ForbiddenException $e) { + } catch (NotPermittedException $e) { return false; } $names = array_map(function ($info) { |