Skip to content
This repository has been archived by the owner on Jan 10, 2021. It is now read-only.

Commit

Permalink
Correcting an issue where fallback URLs were not being resolved as ex…
Browse files Browse the repository at this point in the history
…pected.
  • Loading branch information
Nathan Glasl committed Jun 6, 2016
1 parent 4ef298d commit 64f16e5
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions code/services/MisdirectionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,19 +292,25 @@ public function determineFallback($URL) {
if($applicableRule) {
$link = null;
switch($applicableRule) {

// Bypass the request filter.

case 'Nearest':
$link = $nearestParent;
$link = '/' . HTTP::setGetVar('misdirected', true, $nearestParent);
break;
case 'This':
$link = $thisPage;
$link = '/' . HTTP::setGetVar('misdirected', true, $thisPage);
break;
case 'URL':
$link = self::is_external_URL($toURL) ? (ClassInfo::exists('Multisites') ? HTTP::setGetVar('misdirected', true, $toURL) : $toURL) : Controller::join_links(Director::baseURL(), $toURL);

// When appropriate, prepend the base URL to match a page redirection.

$link = self::is_external_URL($toURL) ? (ClassInfo::exists('Multisites') ? HTTP::setGetVar('misdirected', true, $toURL) : $toURL) : ('/' . HTTP::setGetVar('misdirected', true, Controller::join_links(Director::baseURL(), $toURL)));
break;
}
if($link) {
return array(
'link' => self::is_external_URL($link) ? $link : ('/' . HTTP::setGetVar('misdirected', true, $link)),
'link' => $link,
'code' => (int)$responseCode
);
}
Expand Down

0 comments on commit 64f16e5

Please sign in to comment.