Show 404 page when accessing empty share URL

Testplan:
- [ ] Without: Accessing `public.php?service=files&t=` throws an exception
- [ ] With: No exception thrown and 404 page displayed.

Fixes https://github.com/owncloud/core/issues/14231
This commit is contained in:
Lukas Reschke 2015-02-25 17:26:54 +01:00
parent 14c592fe86
commit fca4628a5c
1 changed files with 7 additions and 1 deletions

View File

@ -25,4 +25,10 @@ $urlGenerator = new \OC\URLGenerator(\OC::$server->getConfig());
$token = isset($_GET['t']) ? $_GET['t'] : '';
$route = isset($_GET['download']) ? 'files_sharing.sharecontroller.downloadShare' : 'files_sharing.sharecontroller.showShare';
OC_Response::redirect($urlGenerator->linkToRoute($route, array('token' => $token)));
if($token !== '') {
OC_Response::redirect($urlGenerator->linkToRoute($route, array('token' => $token)));
} else {
header('HTTP/1.0 404 Not Found');
$tmpl = new OCP\Template('', '404', 'guest');
print_unescaped($tmpl->fetchPage());
}