aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/base.php8
-rw-r--r--lib/private/urlgenerator.php2
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/base.php b/lib/base.php
index 6a1841fa93b..8c68b887a05 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);
diff --git a/lib/private/urlgenerator.php b/lib/private/urlgenerator.php
index fb1ea737ef4..94de8ed8f6e 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;
}