shareManager = $shareManager; $this->userSession = $userSession; $this->urlGenerator = $urlGenerator; } #[NoAdminRequired] #[NoCSRFRequired] public function accept(string $shareId): Response { try { $share = $this->shareManager->getShareById($shareId); } catch (ShareNotFound $e) { return new NotFoundResponse(); } $user = $this->userSession->getUser(); if ($user === null) { return new NotFoundResponse(); } try { $share = $this->shareManager->acceptShare($share, $user->getUID()); } catch (\Exception $e) { // Just ignore } $url = $this->urlGenerator->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $share->getNode()->getId()]); return new RedirectResponse($url); } }