From a89dbd29e157f6be9caf84f725e1fbfc12aa4844 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Thu, 31 Jul 2014 17:05:57 +1200 Subject: [PATCH] Revert #3345 #3323 --- control/Director.php | 2 +- tests/control/DirectorTest.php | 4 ---- tests/control/HTTPTest.php | 6 ------ 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/control/Director.php b/control/Director.php index f8c23b6df..b0c7cea8f 100644 --- a/control/Director.php +++ b/control/Director.php @@ -425,7 +425,7 @@ class Director implements TemplateGlobalProvider { } if(substr($url,0,4) != "http") { - if(strpos($url, '/') !== 0) $url = Director::baseURL() . $url; + if($url[0] != "/") $url = Director::baseURL() . $url; // Sometimes baseURL() can return a full URL instead of just a path if(substr($url,0,4) != "http") $url = self::protocolAndHost() . $url; } diff --git a/tests/control/DirectorTest.php b/tests/control/DirectorTest.php index e89d9f3c6..b3a9d9323 100644 --- a/tests/control/DirectorTest.php +++ b/tests/control/DirectorTest.php @@ -97,9 +97,6 @@ class DirectorTest extends SapphireTest { $_SERVER['REQUEST_URI'] = "$rootURL/mysite/sub-page/"; Config::inst()->update('Director', 'alternate_base_url', '/mysite/'); - //test empty URL - $this->assertEquals($rootURL, Director::absoluteURL('')); - // Test already absolute url $this->assertEquals($rootURL, Director::absoluteURL($rootURL)); $this->assertEquals($rootURL, Director::absoluteURL($rootURL, true)); @@ -140,7 +137,6 @@ class DirectorTest extends SapphireTest { Config::inst()->update('Director', 'alternate_base_url', 'http://www.example.org/'); $this->assertEquals('http://www.example.org/', Director::baseURL()); $this->assertEquals('http://www.example.org/', Director::absoluteBaseURL()); - $this->assertEquals('http://www.example.org/', Director::absoluteURL('')); $this->assertEquals('http://www.example.org/subfolder/test', Director::absoluteURL('subfolder/test')); // Setting it to false restores functionality diff --git a/tests/control/HTTPTest.php b/tests/control/HTTPTest.php index a9b637210..2d6a08e34 100644 --- a/tests/control/HTTPTest.php +++ b/tests/control/HTTPTest.php @@ -161,12 +161,6 @@ class HTTPTest extends SapphireTest { public function testAbsoluteURLsAttributes() { $this->withBaseURL('http://www.silverstripe.org/', function($test){ - //empty links - $test->assertEquals( - 'test', - HTTP::absoluteURLs('test') - ); - // links $test->assertEquals( 'SS Blog',