Skip to content

Commit dff9d30

Browse files
fix(files): Fix controller setup for guests
Signed-off-by: Joas Schilling <[email protected]>
1 parent b21ef48 commit dff9d30

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

apps/files/lib/Service/TagService.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,17 @@ class TagService {
4242
private $userSession;
4343
/** @var IManager */
4444
private $activityManager;
45-
/** @var ITags */
45+
/** @var ITags|null */
4646
private $tagger;
4747
/** @var Folder */
4848
private $homeFolder;
4949
/** @var EventDispatcherInterface */
5050
private $dispatcher;
5151

52-
/**
53-
* @param IUserSession $userSession
54-
* @param IManager $activityManager
55-
* @param ITags $tagger
56-
* @param Folder $homeFolder
57-
* @param EventDispatcherInterface $dispatcher
58-
*/
5952
public function __construct(
6053
IUserSession $userSession,
6154
IManager $activityManager,
62-
ITags $tagger,
55+
?ITags $tagger,
6356
Folder $homeFolder,
6457
EventDispatcherInterface $dispatcher
6558
) {
@@ -81,6 +74,10 @@ public function __construct(
8174
* @throws \OCP\Files\NotFoundException if the file does not exist
8275
*/
8376
public function updateFileTags($path, $tags) {
77+
if ($this->tagger === null) {
78+
throw new \RuntimeException('No tagger set');
79+
}
80+
8481
$fileId = $this->homeFolder->get($path)->getId();
8582

8683
$currentTags = $this->tagger->getTagsForObjects([$fileId]);

0 commit comments

Comments
 (0)