From 125b7e75121ee8b3ca35553f5c3365884557189f Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Wed, 2 Dec 2015 11:26:41 +0100 Subject: [PATCH 1/2] Ensure that ownCloud is always accessed with a trailing slash --- lib/base.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/base.php b/lib/base.php index 6a1841fa93..8c68b887a0 100644 --- a/lib/base.php +++ b/lib/base.php @@ -169,6 +169,14 @@ class OC { } } + // Resolve /owncloud to /owncloud/ to ensure to always have a trailing + // slash which is required by URL generation. + if($_SERVER['REQUEST_URI'] === \OC::$WEBROOT && + substr($_SERVER['REQUEST_URI'], -1) !== '/') { + header('Location: '.\OC::$WEBROOT.'/'); + exit(); + } + // search the 3rdparty folder OC::$THIRDPARTYROOT = OC_Config::getValue('3rdpartyroot', null); OC::$THIRDPARTYWEBROOT = OC_Config::getValue('3rdpartyurl', null); From 09d9e430d8de207fc9528329e4d0ea49272aa589 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Wed, 2 Dec 2015 11:27:07 +0100 Subject: [PATCH 2/2] Add a trailing slash to generated URLs --- lib/private/urlgenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/urlgenerator.php b/lib/private/urlgenerator.php index fb1ea737ef..94de8ed8f6 100644 --- a/lib/private/urlgenerator.php +++ b/lib/private/urlgenerator.php @@ -114,7 +114,7 @@ class URLGenerator implements IURLGenerator { $urlLinkTo = \OC::$WEBROOT . '/core/' . $file; } else { if ($frontControllerActive && $file === 'index.php') { - $urlLinkTo = \OC::$WEBROOT; + $urlLinkTo = \OC::$WEBROOT . '/'; } else { $urlLinkTo = \OC::$WEBROOT . '/' . $file; }