From 9482d02903c2c92e745c04f56f15ec3a417163e9 Mon Sep 17 00:00:00 2001 From: Jakub Wolniewicz Date: Tue, 11 May 2021 18:39:29 +0200 Subject: [PATCH] Allow forward slashes inside integrity attribute --- src/Middleware/RemoveComments.php | 2 +- tests/Boilerplate/index.html | 2 ++ tests/Middleware/RemoveCommentsTest.php | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Middleware/RemoveComments.php b/src/Middleware/RemoveComments.php index f6e476c..9c5d609 100644 --- a/src/Middleware/RemoveComments.php +++ b/src/Middleware/RemoveComments.php @@ -4,7 +4,7 @@ class RemoveComments extends PageSpeed { - const REGEX_MATCH_JS_AND_CSS_COMMENTS = '/(?:(?:\/\*(?:[^*]|(?:\*+[^*\/]))*\*+\/)|(?:(?/s'; public function apply($buffer) diff --git a/tests/Boilerplate/index.html b/tests/Boilerplate/index.html index 676e5ab..70f663b 100644 --- a/tests/Boilerplate/index.html +++ b/tests/Boilerplate/index.html @@ -85,6 +85,8 @@

Test Background Image

+ + diff --git a/tests/Middleware/RemoveCommentsTest.php b/tests/Middleware/RemoveCommentsTest.php index 2f1994e..d75c90d 100644 --- a/tests/Middleware/RemoveCommentsTest.php +++ b/tests/Middleware/RemoveCommentsTest.php @@ -125,5 +125,10 @@ public function testRemoveJsComments() $this->assertStringContainsString("console.log('Laravel');", $this->response->getContent()); $this->assertStringContainsString("console.log('Page');", $this->response->getContent()); $this->assertStringContainsString("console.log('Speed!');", $this->response->getContent()); + + $this->assertStringContainsString( + '', + $this->response->getContent() + ); } }