Browse Source

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
tags/v8.1.0alpha1
Lukas Reschke 9 years ago
parent
commit
fca4628a5c
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      apps/files_sharing/public.php

+ 7
- 1
apps/files_sharing/public.php 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());
}

Loading…
Cancel
Save