diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-02-25 17:26:54 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-02-25 17:29:12 +0100 |
commit | fca4628a5c7b9e56d8c3c195fb1fd1c7eeb1c262 (patch) | |
tree | 5a3a9d5a36e4e50b15d9eb19ce562b762a381ab4 /apps/files_sharing/public.php | |
parent | 14c592fe865748f38dd6ee31634d053f83a8e791 (diff) | |
download | nextcloud-server-fca4628a5c7b9e56d8c3c195fb1fd1c7eeb1c262.tar.gz nextcloud-server-fca4628a5c7b9e56d8c3c195fb1fd1c7eeb1c262.zip |
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
Diffstat (limited to 'apps/files_sharing/public.php')
-rw-r--r-- | apps/files_sharing/public.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php index 028c6da12f9..ebc5b7bda45 100644 --- a/apps/files_sharing/public.php +++ b/apps/files_sharing/public.php @@ -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()); +} |