]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(files): Fix controller setup for guests 37057/head
authorJoas Schilling <coding@schilljs.com>
Tue, 28 Feb 2023 14:34:11 +0000 (15:34 +0100)
committerArthur Schiwon (Rebase PR Action) <blizzz@users.noreply.github.com>
Thu, 9 Mar 2023 12:21:07 +0000 (12:21 +0000)
Signed-off-by: Joas Schilling <coding@schilljs.com>
apps/files/lib/Service/TagService.php

index 29b6fbc2840c0041acef96b927cef541e2bf949e..0ea60ec09d8efbc4809ae32cf0a24d0839036f6c 100644 (file)
@@ -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]);