From 8aa0f0485df5238739e9c3436f7aefebba53e66f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Thu, 26 Jul 2018 22:08:48 +0200 Subject: [PATCH 1/2] Fix regex for icon urls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the version from the url rather than hardcoding v=1. Also allow uppercase chars in the url, so that uppercase hex color values will also be included Signed-off-by: Julius Härtl --- core/img/actions/star-dark.svg | 2 +- lib/private/Template/IconsCacher.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/img/actions/star-dark.svg b/core/img/actions/star-dark.svg index 16a7ac53ba..331f167685 100644 --- a/core/img/actions/star-dark.svg +++ b/core/img/actions/star-dark.svg @@ -1 +1 @@ - + diff --git a/lib/private/Template/IconsCacher.php b/lib/private/Template/IconsCacher.php index e5ebecaf16..e5ea1b3381 100644 --- a/lib/private/Template/IconsCacher.php +++ b/lib/private/Template/IconsCacher.php @@ -47,7 +47,7 @@ class IconsCacher { protected $urlGenerator; /** @var string */ - private $iconVarRE = '/--(icon-[a-zA-Z0-9-]+): url\(["\']([a-z0-9-_\~\/\.]+)[^;]+;/m'; + private $iconVarRE = '/--(icon-[a-zA-Z0-9-]+): url\(["\']([a-zA-Z0-9-_\~\/\.\?\=]+)[^;]+;/m'; /** @var string */ private $fileName = 'icons-vars.css'; @@ -101,7 +101,7 @@ class IconsCacher { $data = ''; foreach ($icons as $icon => $url) { - $data .= "--$icon: url('$url?v=1');"; + $data .= "--$icon: url('$url');"; } if (strlen($data) > 0) { From f77cc11a2832c83c7246fb3adb946b46c9361a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Thu, 26 Jul 2018 22:26:05 +0200 Subject: [PATCH 2/2] Fix tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- tests/lib/Template/IconsCacherTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/Template/IconsCacherTest.php b/tests/lib/Template/IconsCacherTest.php index d02f5b3f05..d6a9908989 100644 --- a/tests/lib/Template/IconsCacherTest.php +++ b/tests/lib/Template/IconsCacherTest.php @@ -86,7 +86,7 @@ class IconsCacherTest extends \Test\TestCase { "; $actual = self::invokePrivate($this->iconsCacher, 'getIconsFromCss', [$css]); $expected = array( - 'icon-test' => '/svg/core/actions/add/000' + 'icon-test' => '/svg/core/actions/add/000?v=1' ); $this->assertEquals($expected, $actual); }