summaryrefslogtreecommitdiffstats
path: root/apps/files/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-02-28 15:34:11 +0100
committerJoas Schilling <coding@schilljs.com>2023-02-28 15:34:11 +0100
commitc02080fccb7d87507b2be608bed1cc66096b6506 (patch)
tree47edcd54a0ef3d22be0d38d4723da160ddfe5392 /apps/files/lib
parentc440f00219e04e5d64a14991ad946b76a53f9680 (diff)
downloadnextcloud-server-c02080fccb7d87507b2be608bed1cc66096b6506.tar.gz
nextcloud-server-c02080fccb7d87507b2be608bed1cc66096b6506.zip
fix(files): Fix controller setup for guests
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/files/lib')
-rw-r--r--apps/files/lib/Service/TagService.php15
1 files changed, 6 insertions, 9 deletions
diff --git a/apps/files/lib/Service/TagService.php b/apps/files/lib/Service/TagService.php
index 29b6fbc2840..0ea60ec09d8 100644
--- a/apps/files/lib/Service/TagService.php
+++ b/apps/files/lib/Service/TagService.php
@@ -42,24 +42,17 @@ class TagService {
private $userSession;
/** @var IManager */
private $activityManager;
- /** @var ITags */
+ /** @var ITags|null */
private $tagger;
/** @var Folder */
private $homeFolder;
/** @var EventDispatcherInterface */
private $dispatcher;
- /**
- * @param IUserSession $userSession
- * @param IManager $activityManager
- * @param ITags $tagger
- * @param Folder $homeFolder
- * @param EventDispatcherInterface $dispatcher
- */
public function __construct(
IUserSession $userSession,
IManager $activityManager,
- ITags $tagger,
+ ?ITags $tagger,
Folder $homeFolder,
EventDispatcherInterface $dispatcher
) {
@@ -81,6 +74,10 @@ class TagService {
* @throws \OCP\Files\NotFoundException if the file does not exist
*/
public function updateFileTags($path, $tags) {
+ if ($this->tagger === null) {
+ throw new \RuntimeException('No tagger set');
+ }
+
$fileId = $this->homeFolder->get($path)->getId();
$currentTags = $this->tagger->getTagsForObjects([$fileId]);