diff --git a/_config/mimetypes.yml b/_config/mimetypes.yml index 48328042797..bd9ce94d759 100644 --- a/_config/mimetypes.yml +++ b/_config/mimetypes.yml @@ -362,7 +362,7 @@ SilverStripe\Control\HTTP: jpgm: video/jpm jpgv: video/jpeg jpm: video/jpm - js: application/javascript + js: text/javascript json: application/json jsonml: application/jsonml+json kar: audio/midi diff --git a/src/Control/HTTPResponse.php b/src/Control/HTTPResponse.php index 5e657ef6b36..d16ef1e99fa 100644 --- a/src/Control/HTTPResponse.php +++ b/src/Control/HTTPResponse.php @@ -363,7 +363,7 @@ protected function htmlRedirect() echo <<Redirecting to {$title}

- EOT diff --git a/src/Security/CMSSecurity.php b/src/Security/CMSSecurity.php index 290134d4397..73898012b88 100644 --- a/src/Security/CMSSecurity.php +++ b/src/Security/CMSSecurity.php @@ -133,7 +133,7 @@ protected function redirectToExternalLogin() $message - diff --git a/src/Security/MemberAuthenticator/CMSLoginHandler.php b/src/Security/MemberAuthenticator/CMSLoginHandler.php index a9049224faa..1610be45c28 100644 --- a/src/Security/MemberAuthenticator/CMSLoginHandler.php +++ b/src/Security/MemberAuthenticator/CMSLoginHandler.php @@ -90,7 +90,7 @@ protected function redirectToChangePassword() $message - diff --git a/src/View/Requirements_Backend.php b/src/View/Requirements_Backend.php index 869f636a289..53749ff8121 100644 --- a/src/View/Requirements_Backend.php +++ b/src/View/Requirements_Backend.php @@ -810,7 +810,7 @@ public function includeInHTML($content) foreach ($this->getJavascript() as $file => $attributes) { // Build html attributes $htmlAttributes = [ - 'type' => isset($attributes['type']) ? $attributes['type'] : "application/javascript", + 'type' => isset($attributes['type']) ? $attributes['type'] : null, 'src' => $this->pathForFile($file), ]; if (!empty($attributes['async'])) { @@ -832,7 +832,7 @@ public function includeInHTML($content) // Add all inline JavaScript *after* including external files they might rely on foreach ($this->getCustomScripts() as $key => $script) { // Build html attributes - $customHtmlAttributes = ['type' => 'application/javascript']; + $customHtmlAttributes = []; if (isset($this->customScriptAttributes[$key])) { foreach ($this->customScriptAttributes[$key] as $attrKey => $attrValue) { $customHtmlAttributes[$attrKey] = $attrValue; diff --git a/tests/php/Core/ConvertTest.php b/tests/php/Core/ConvertTest.php index fc497f6edb7..1cdbec6d17f 100644 --- a/tests/php/Core/ConvertTest.php +++ b/tests/php/Core/ConvertTest.php @@ -102,7 +102,7 @@ public function testHtml2raw() 'Strong tags with attributes are replaced with asterisks' ); - $val3 = ''; + $val3 = ''; $this->assertEquals( '', Convert::html2raw($val3), @@ -116,7 +116,7 @@ public function testHtml2raw() 'Style tags are completely removed' ); - $val5 = ""; + $val5 = ""; $this->assertEquals( '', Convert::html2raw($val5), diff --git a/tests/php/View/RequirementsTest.php b/tests/php/View/RequirementsTest.php index 61553c4391a..cacf4827ec5 100644 --- a/tests/php/View/RequirementsTest.php +++ b/tests/php/View/RequirementsTest.php @@ -392,7 +392,7 @@ public function testCustomType() $result ); $this->assertMatchesRegularExpression( - '#\n", $html ); @@ -1094,8 +1094,8 @@ public function testForceJsToBottom() $template = '
My header

Body

'; // The expected outputs - $expectedScripts = "\n" - . "\n" + . "\n"; $JsInHead = "$expectedScripts
My header

Body

"; @@ -1407,7 +1407,7 @@ public function testSriAttributes() /* Javascript has correct attributes */ $this->assertMatchesRegularExpression( - '##s", + "##s", $html, 'customScript is correctly not displaying original write' ); /* customScriptWithAttributes is overwritten by customScript */ $this->assertMatchesRegularExpression( - "##s", + "##s", $html, 'customScript is displaying latest write and clearing attributes' );