Skip to content

Commit

Permalink
Merge pull request #37057 from nextcloud/backport/36904/stable26
Browse files Browse the repository at this point in the history
[stable26] fix(files): Fix controller setup for guests
  • Loading branch information
blizzz authored Mar 9, 2023
2 parents 72cf710 + 442bce3 commit 92b8a5e
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions apps/files/lib/Service/TagService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
) {
Expand All @@ -81,6 +74,10 @@ public function __construct(
* @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]);
Expand Down

0 comments on commit 92b8a5e

Please sign in to comment.