Use getAbsoluteUrl for redirection URL
Also separate the function into getDefaultPageUrl() and redirectToDefaultPage() to make it testable.
This commit is contained in:
parent
c005515ebd
commit
3e78f41d00
1 changed files with 17 additions and 5 deletions
|
@ -815,10 +815,13 @@ class OC_Util {
|
|||
}
|
||||
|
||||
/**
|
||||
* Redirect to the user default page
|
||||
* @return void
|
||||
* Returns the URL of the default page
|
||||
* based on the system configuration and
|
||||
* the apps visible for the current user
|
||||
*
|
||||
* @return string URL
|
||||
*/
|
||||
public static function redirectToDefaultPage() {
|
||||
public static function getDefaultPageUrl() {
|
||||
$urlGenerator = \OC::$server->getURLGenerator();
|
||||
if(isset($_REQUEST['redirect_url'])) {
|
||||
$location = urldecode($_REQUEST['redirect_url']);
|
||||
|
@ -837,9 +840,18 @@ class OC_Util {
|
|||
break;
|
||||
}
|
||||
}
|
||||
$location = $urlGenerator->linkTo($appId, 'index.php');
|
||||
$location = $urlGenerator->getAbsoluteURL('/index.php/apps/' . $appId . '/');
|
||||
}
|
||||
}
|
||||
return $location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect to the user default page
|
||||
* @return void
|
||||
*/
|
||||
public static function redirectToDefaultPage() {
|
||||
$location = self::getDefaultPageUrl();
|
||||
OC_Log::write('core', 'redirectToDefaultPage: '.$location, OC_Log::DEBUG);
|
||||
header('Location: '.$location);
|
||||
exit();
|
||||
|
|
Loading…
Reference in a new issue