From 740aaa69f5dbed834b4d85f13ce3a8d8959267d1 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 15 Nov 2016 21:56:28 +0000 Subject: [PATCH] Bugfix: "remove_baseurl" accidentally normalized all links --- boot.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/boot.php b/boot.php index 88f7ad7829..230cbc1e3a 100644 --- a/boot.php +++ b/boot.php @@ -1045,16 +1045,24 @@ class App { * * @return string The cleaned url */ - function remove_baseurl($url){ + function remove_baseurl($orig_url){ // Is the function called statically? - if (!is_object($this)) + if (!is_object($this)) { return(self::$a->remove_baseurl($url)); + } - $url = normalise_link($url); + // Remove the hostname from the url if it is an internal link + $url = normalise_link($orig_url); $base = normalise_link($this->get_baseurl()); $url = str_replace($base."/", "", $url); - return $url; + + // if it is an external link return the orignal value + if ($url == normalise_link($orig_url)) { + return $orig_url; + } else { + return $url; + } } /**