diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2023-04-20 13:55:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-20 13:55:26 +0200 |
commit | 590c202797e6f5018635e45cdb2ed79ecd1c9865 (patch) | |
tree | edae7e161809ccc56b759279273176d5fb12d28d /apps/files | |
parent | 60b7d2117ed0963a341aa6ebac103d1bc77aebf0 (diff) | |
parent | 8b31d8204fcc51e55cde846446a183c2fcb58fcf (diff) | |
download | nextcloud-server-590c202797e6f5018635e45cdb2ed79ecd1c9865.tar.gz nextcloud-server-590c202797e6f5018635e45cdb2ed79ecd1c9865.zip |
Merge pull request #37826 from nextcloud/bugfix/noid/no-error-for-guests
fix(files): Don't throw an error when guests access the controller
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/lib/Controller/ApiController.php | 18 | ||||
-rw-r--r-- | apps/files/lib/Service/TagService.php | 7 |
2 files changed, 9 insertions, 16 deletions
diff --git a/apps/files/lib/Controller/ApiController.php b/apps/files/lib/Controller/ApiController.php index 9b5d12baa96..fd0f3bdf261 100644 --- a/apps/files/lib/Controller/ApiController.php +++ b/apps/files/lib/Controller/ApiController.php @@ -70,28 +70,18 @@ class ApiController extends Controller { private IPreview $previewManager; private IUserSession $userSession; private IConfig $config; - private Folder $userFolder; + private ?Folder $userFolder; private UserConfig $userConfig; private ViewConfig $viewConfig; - /** - * @param string $appName - * @param IRequest $request - * @param IUserSession $userSession - * @param TagService $tagService - * @param IPreview $previewManager - * @param IManager $shareManager - * @param IConfig $config - * @param Folder $userFolder - */ - public function __construct($appName, + public function __construct(string $appName, IRequest $request, IUserSession $userSession, TagService $tagService, IPreview $previewManager, IManager $shareManager, IConfig $config, - Folder $userFolder, + ?Folder $userFolder, UserConfig $userConfig, ViewConfig $viewConfig) { parent::__construct($appName, $request); @@ -406,7 +396,7 @@ class ApiController extends Controller { $node = $this->userFolder->get($folderpath); return $node->getType(); } - + /** * @NoAdminRequired * @NoCSRFRequired diff --git a/apps/files/lib/Service/TagService.php b/apps/files/lib/Service/TagService.php index 0ea60ec09d8..af4f7d0ef1e 100644 --- a/apps/files/lib/Service/TagService.php +++ b/apps/files/lib/Service/TagService.php @@ -44,7 +44,7 @@ class TagService { private $activityManager; /** @var ITags|null */ private $tagger; - /** @var Folder */ + /** @var Folder|null */ private $homeFolder; /** @var EventDispatcherInterface */ private $dispatcher; @@ -53,7 +53,7 @@ class TagService { IUserSession $userSession, IManager $activityManager, ?ITags $tagger, - Folder $homeFolder, + ?Folder $homeFolder, EventDispatcherInterface $dispatcher ) { $this->userSession = $userSession; @@ -77,6 +77,9 @@ class TagService { if ($this->tagger === null) { throw new \RuntimeException('No tagger set'); } + if ($this->homeFolder === null) { + throw new \RuntimeException('No homeFolder set'); + } $fileId = $this->homeFolder->get($path)->getId(); |