diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 1568e0c9f548e..dee2b99881166 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -150,7 +150,7 @@ protected function getStorageInfo() { public function showFile(string $fileid = null): Response { // This is the entry point from the `/f/{fileid}` URL which is hardcoded in the server. try { - return $this->redirectToFile($fileid); + return $this->redirectToFile($fileid, true); } catch (NotFoundException $e) { return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', ['fileNotFound' => true])); } @@ -318,6 +318,7 @@ public function index($dir = '', $view = '', $fileid = null, $fileNotFound = fal * Redirects to the file list and highlight the given file id * * @param string $fileId file id to show + * @param bool $setOpenfile - whether or not to set the openfile URL parameter * @return RedirectResponse redirect response or not found response * @throws \OCP\Files\NotFoundException */ @@ -343,6 +344,11 @@ private function redirectToFile($fileId) { $params['dir'] = $baseFolder->getRelativePath($file->getParent()->getPath()); // and scroll to the entry $params['scrollto'] = $file->getName(); + + if ($setOpenfile) { + // forward the openfile URL parameter. + $params['openfile'] = $fileId; + } } return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', $params));