From c14107550d8c7588bb78e7ffc34c7190e475c23e Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Fri, 28 Mar 2014 18:05:48 +0100 Subject: [PATCH 1/3] Use UrlGenerator in OC\Util::redirectToDefaultPage(). Fix #7936 --- lib/private/util.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/private/util.php b/lib/private/util.php index c48a5505d4..c1adbaf254 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -701,17 +701,18 @@ class OC_Util { * @return void */ public static function redirectToDefaultPage() { + $urlGenerator = \OC::$server->getURLGenerator(); if(isset($_REQUEST['redirect_url'])) { - $location = OC_Helper::makeURLAbsolute(urldecode($_REQUEST['redirect_url'])); + $location = $urlGenerator->getAbsoluteURL(urldecode($_REQUEST['redirect_url'])); } else if (isset(OC::$REQUESTEDAPP) && !empty(OC::$REQUESTEDAPP)) { - $location = OC_Helper::linkToAbsolute( OC::$REQUESTEDAPP, 'index.php' ); + $location = $urlGenerator->getAbsoluteURL('/index.php/apps/'.OC::$REQUESTEDAPP.'/index.php'); } else { $defaultPage = OC_Appconfig::getValue('core', 'defaultpage'); if ($defaultPage) { - $location = OC_Helper::makeURLAbsolute(OC::$WEBROOT.'/'.$defaultPage); + $location = $urlGenerator->getAbsoluteURL($defaultPage); } else { - $location = OC_Helper::linkToAbsolute( 'files', 'index.php' ); + $location = $urlGenerator->getAbsoluteURL('/index.php/files/index.php'); } } OC_Log::write('core', 'redirectToDefaultPage: '.$location, OC_Log::DEBUG); From 3a7829f784a3f98642ac19b633c003e74aa87e9d Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Sat, 29 Mar 2014 20:39:55 +0100 Subject: [PATCH 2/3] Sub-dir was prepended twice --- lib/private/helper.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/private/helper.php b/lib/private/helper.php index 98a86388d2..d7ac0b5f4f 100644 --- a/lib/private/helper.php +++ b/lib/private/helper.php @@ -78,8 +78,7 @@ class OC_Helper { * Returns a absolute url to the given app and file. */ public static function linkToAbsolute($app, $file, $args = array()) { - $urlLinkTo = self::linkTo($app, $file, $args); - return self::makeURLAbsolute($urlLinkTo); + return self::linkTo($app, $file, $args); } /** From 7278f2f5673ca3ebc62938f854cb1028bb5bcfef Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Sat, 29 Mar 2014 20:40:49 +0100 Subject: [PATCH 3/3] Sub-dir was prepended twice --- lib/private/util.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/util.php b/lib/private/util.php index c1adbaf254..731b7c9750 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -703,7 +703,7 @@ class OC_Util { public static function redirectToDefaultPage() { $urlGenerator = \OC::$server->getURLGenerator(); if(isset($_REQUEST['redirect_url'])) { - $location = $urlGenerator->getAbsoluteURL(urldecode($_REQUEST['redirect_url'])); + $location = urldecode($_REQUEST['redirect_url']); } else if (isset(OC::$REQUESTEDAPP) && !empty(OC::$REQUESTEDAPP)) { $location = $urlGenerator->getAbsoluteURL('/index.php/apps/'.OC::$REQUESTEDAPP.'/index.php');