diff --git a/control/HTTP.php b/control/HTTP.php index 829c0fda6..7e991b3fa 100644 --- a/control/HTTP.php +++ b/control/HTTP.php @@ -42,6 +42,7 @@ class HTTP { public static function absoluteURLs($html) { $html = str_replace('$CurrentPageURL', $_SERVER['REQUEST_URI'], $html); return HTTP::urlRewriter($html, function($url) { + if(stripos($url, 'mailto:') === 0) return $url; return Director::absoluteURL($url, true); }); } diff --git a/tests/control/HTTPTest.php b/tests/control/HTTPTest.php index a7efec132..1503a5592 100644 --- a/tests/control/HTTPTest.php +++ b/tests/control/HTTPTest.php @@ -187,6 +187,18 @@ class HTTPTest extends SapphireTest { }); } + public function testEmailLinks() { + $this->withBaseURL('http://www.silverstripe.org/', function($test){ + + // links + $test->assertEquals( + 'Email Us', + HTTP::absoluteURLs('Email Us') + ); + }); + + } + /** * Run a test while mocking the base url with the provided value * @param string $url The base URL to use for this test