Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-03-14 17:12:16 +0300
committerJoas Schilling <coding@schilljs.com>2019-03-14 17:13:56 +0300
commit5e5c5a16dc6b26b7a9c367a2a395527ea818c764 (patch)
tree58027e3e374babcfc45d524041fb343605fa54bb /apps
parent762a8bb3d9521a9f75d9e186150cb77241b3bc19 (diff)
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.php16
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);