Merge pull request #30690 from nextcloud/backport/30645/stable22

[stable22] New Files internal link GET param to avoid opening the file
This commit is contained in:
Louis 2022-01-17 10:39:59 +01:00 committed by GitHub
commit d316e5a49b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -162,10 +162,10 @@ class ViewController extends Controller {
* @return TemplateResponse|RedirectResponse
* @throws NotFoundException
*/
public function showFile(string $fileid = null): Response {
public function showFile(string $fileid = null, int $openfile = 1): Response {
// This is the entry point from the `/f/{fileid}` URL which is hardcoded in the server.
try {
return $this->redirectToFile($fileid, true);
return $this->redirectToFile($fileid, $openfile !== 0);
} catch (NotFoundException $e) {
return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', ['fileNotFound' => true]));
}