diff options
author | Joas Schilling <coding@schilljs.com> | 2019-03-14 15:12:16 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-03-14 15:13:56 +0100 |
commit | 5e5c5a16dc6b26b7a9c367a2a395527ea818c764 (patch) | |
tree | 58027e3e374babcfc45d524041fb343605fa54bb /apps | |
parent | 762a8bb3d9521a9f75d9e186150cb77241b3bc19 (diff) | |
download | nextcloud-server-5e5c5a16dc6b26b7a9c367a2a395527ea818c764.tar.gz nextcloud-server-5e5c5a16dc6b26b7a9c367a2a395527ea818c764.zip |
Add correct method for hardcoded `/f/{fileid}`
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/lib/Controller/ViewController.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index fc0fb120cfe..3f35b8b7be5 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -132,6 +132,18 @@ class ViewController extends Controller { * @NoCSRFRequired * @NoAdminRequired * + * @param string $fileid + * @return TemplateResponse|RedirectResponse + */ + public function showFile(string $fileid = null): Response { + // This is the entry point from the `/f/{fileid}` URL which is hardcoded in the server. + return $this->redirectToFile($fileid); + } + + /** + * @NoCSRFRequired + * @NoAdminRequired + * * @param string $dir * @param string $view * @param string $fileid @@ -140,7 +152,7 @@ class ViewController extends Controller { public function index($dir = '', $view = '', $fileid = null, $fileNotFound = false) { if ($fileid !== null) { try { - return $this->showFile($fileid); + return $this->redirectToFile($fileid); } catch (NotFoundException $e) { return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', ['fileNotFound' => true])); } @@ -285,7 +297,7 @@ class ViewController extends Controller { * @return RedirectResponse redirect response or not found response * @throws \OCP\Files\NotFoundException */ - private function showFile($fileId) { + private function redirectToFile($fileId) { $uid = $this->userSession->getUser()->getUID(); $baseFolder = $this->rootFolder->getUserFolder($uid); $files = $baseFolder->getById($fileId); |