Merge pull request #10415 from nextcloud/bugfix/noid/regex-icons

Fix regex for icon urls
This commit is contained in:
Roeland Jago Douma 2018-07-27 07:23:04 +02:00 committed by GitHub
commit 7b23cf3dc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 16 16" width="16" height="16"><path d="m8 0.5 2.2 5.3 5.8 0.45-4.5 3.75 1.5 5.5-5-3.1-5 3.1 1.5-5.5-4.5-3.75 5.8-0.45z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 16 16" width="16" height="16"><path d="m8 0.5 2.2 5.3 5.8 0.45-4.5 3.75 1.5 5.5-5-3.1-5 3.1 1.5-5.5-4.5-3.75 5.8-0.45z" fill="#000"/></svg>

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 207 B

View File

@ -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) {

View File

@ -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);
}