Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

BUGFIX Fixed ContentNegotiator to handle HTML and XHTML base tags pro…

…perly when converting, regression from r108413 (from r108421)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112815 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
commit fcc20b5e1a0e305724ed0c916d58c32ee8c41278 1 parent a588ae3
@sminnee sminnee authored
Showing with 5 additions and 5 deletions.
  1. +3 −3 core/control/ContentNegotiator.php
  2. +2 −2 tests/SSViewerTest.php
View
6 core/control/ContentNegotiator.php
@@ -141,8 +141,8 @@ function xhtml(SS_HTTPResponse $response) {
$response->addHeader("Vary" , "Accept");
// Fix base tag
- $content = preg_replace('/<base href="([^"]*)"><!--\[if[[^\]*]\]><\/base><!\[endif\]-->/',
- '<base href="$1"></base>', $content);
+ $content = preg_replace('/<base href="([^"]*)"><!--\[if[[^\]*]\] \/><!\[endif\]-->/',
+ '<base href="$1" />', $content);
$content = str_replace('&nbsp;','&#160;', $content);
$content = str_replace('<br>','<br />', $content);
@@ -170,7 +170,7 @@ function html(SS_HTTPResponse $response) {
$hasXMLHeader = (substr($content,0,5) == '<' . '?xml' );
// Fix base tag
- $content = preg_replace('/<base href="([^"]*)"><\/base>/',
+ $content = preg_replace('/<base href="([^"]*)" \/>/',
'<base href="$1"><!--[if lte IE 6]></base><![endif]-->', $content);
$content = ereg_replace("<\\?xml[^>]+\\?>\n?",'',$content);
View
4 tests/SSViewerTest.php
@@ -341,7 +341,7 @@ function testBaseTagGeneration() {
<head><% base_tag %></head>
<body><p>test</p><body>
</html>';
- $this->assertRegExp('/<head><base href=".*"><\/base><\/head>/', $this->render($tmpl1));
+ $this->assertRegExp('/<head><base href=".*" \/><\/head>/', $this->render($tmpl1));
// HTML4 and 5 will only have it for IE
$tmpl2 = '<!DOCTYPE html>
@@ -368,7 +368,7 @@ function testBaseTagGeneration() {
$response = new SS_HTTPResponse($this->render($tmpl1));
$negotiator->xhtml($response);
- $this->assertRegExp('/<head><base href=".*"><\/base><\/head>/', $response->getBody());
+ $this->assertRegExp('/<head><base href=".*" \/><\/head>/', $response->getBody());
}
Please sign in to comment.
Something went wrong with that request. Please try again.