aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-04-19 16:39:57 +0200
committerJoas Schilling <coding@schilljs.com>2023-04-19 16:39:57 +0200
commit8b31d8204fcc51e55cde846446a183c2fcb58fcf (patch)
treed37d9cc10da0a24efa428b7dc541c122e9d66d04 /apps/files
parentfd473f89e8ec31b0d050cc293f698390b2e7e689 (diff)
downloadnextcloud-server-8b31d8204fcc51e55cde846446a183c2fcb58fcf.tar.gz
nextcloud-server-8b31d8204fcc51e55cde846446a183c2fcb58fcf.zip
fix(files): Don't throw an error when guests access the controller
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/lib/Controller/ApiController.php18
-rw-r--r--apps/files/lib/Service/TagService.php7
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();