Skip to content
Snippets Groups Projects
Unverified Commit 2d06ea5c authored by Julius Härtl's avatar Julius Härtl
Browse files

Properly redirect if accessing invalid file though /f/ entrypoint


Signed-off-by: default avatarJulius Härtl <jus@bitgrid.net>
parent 366374d8
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,7 @@ namespace OCA\Files\Controller;
use OCA\Files\Activity\Helper;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\NotFoundResponse;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Http\TemplateResponse;
......@@ -138,7 +139,11 @@ class ViewController extends Controller {
*/
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);
try {
return $this->redirectToFile($fileid);
} catch (NotFoundException $e) {
return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', ['fileNotFound' => true]));
}
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment