Catrope has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/381486 )
Change subject: Revert "CSSMin: Improve encoding of quotes in embedded SVGs"
......................................................................
Revert "CSSMin: Improve encoding of quotes in embedded SVGs"
This reverts commit 5e3165f0080961e637e9ed600b696786aee7eda4.
Bug: T176884
Change-Id: I8bd9af67aeb11cb478ba402205ce834b1bec17a7
---
M includes/libs/CSSMin.php
M tests/phpunit/includes/libs/CSSMinTest.php
2 files changed, 12 insertions(+), 23 deletions(-)
Approvals:
Catrope: Verified; Looks good to me, approved
diff --git a/includes/libs/CSSMin.php b/includes/libs/CSSMin.php
index adaae17..ee88d0d 100644
--- a/includes/libs/CSSMin.php
+++ b/includes/libs/CSSMin.php
@@ -149,7 +149,6 @@
'%2F' => '/', // Unencode slashes
'%3A' => ':', // Unencode colons
'%3D' => '=', // Unencode equals signs
- '%22' => '"', // Unencode double quotes
] );
$uri = 'data:' . $type . ',' . $encoded;
if ( !$ie8Compat || strlen( $uri ) <
self::DATA_URI_SIZE_LIMIT ) {
@@ -216,7 +215,7 @@
if ( preg_match( '!^[\w\d:@/~.%+;,?&=-]+$!', $url ) ) {
return "url($url)";
} else {
- return "url('" . strtr( $url, [ '\\' => '\\\\', "'" =>
"\\'" ] ) . "')";
+ return 'url("' . strtr( $url, [ '\\' => '\\\\', '"' =>
'\\"' ] ) . '")';
}
}
diff --git a/tests/phpunit/includes/libs/CSSMinTest.php
b/tests/phpunit/includes/libs/CSSMinTest.php
index 62f990b..b06df97 100644
--- a/tests/phpunit/includes/libs/CSSMinTest.php
+++ b/tests/phpunit/includes/libs/CSSMinTest.php
@@ -242,7 +242,7 @@
[
"Don't barf at behavior:
url(#default#behaviorName) - T162973",
[ 'foo { behavior: url(#default#bar); }',
false, '/w/', false ],
- 'foo { behavior: url(\'#default#bar\'); }',
+ 'foo { behavior: url("#default#bar"); }',
],
];
}
@@ -271,9 +271,9 @@
// data: URIs for red.gif, green.gif, circle.svg
$red =
'data:image/gif;base64,R0lGODlhAQABAIAAAP8AADAAACwAAAAAAQABAAACAkQBADs=';
$green =
'data:image/gif;base64,R0lGODlhAQABAIAAAACAADAAACwAAAAAAQABAAACAkQBADs=';
- $svg = 'data:image/svg+xml,%3C%3Fxml version="1.0"
encoding="UTF-8"%3F%3E%0A'
- . '%3Csvg xmlns="http://www.w3.org/2000/svg" width="8"
height='
- . '"8"%3E%0A%09%3Ccircle cx="4" cy="4"
r="2"/%3E%0A%3C/svg%3E%0A';
+ $svg = 'data:image/svg+xml,%3C%3Fxml version=%221.0%22
encoding=%22UTF-8%22%3F%3E%0A'
+ . '%3Csvg xmlns=%22http://www.w3.org/2000/svg%22
width=%228%22 height='
+ . '%228%22%3E%0A%09%3Ccircle cx=%224%22 cy=%224%22
r=%222%22/%3E%0A%3C/svg%3E%0A';
// @codingStandardsIgnoreStart Generic.Files.LineLength
return [
@@ -361,7 +361,7 @@
[
'SVG files are embedded without base64 encoding
and unnecessary IE 6 and 7 fallback',
'foo { /* @embed */ background:
url(circle.svg); }',
- "foo { background: url('$svg'); }",
+ "foo { background: url(\"$svg\"); }",
],
[
'Two regular files in one rule',
@@ -444,17 +444,17 @@
[
'Background URL (containing parentheses;
T60473)',
'foo { background:
url("//localhost/styles.css?query=(parens)") }',
- 'foo { background:
url(\'//localhost/styles.css?query=(parens)\') }',
+ 'foo { background:
url("//localhost/styles.css?query=(parens)") }',
],
[
'Background URL (double quoted, containing
single quotes; T60473)',
'foo { background:
url("//localhost/styles.css?quote=\'") }',
- 'foo { background:
url(\'//localhost/styles.css?quote=\\\'\') }',
+ 'foo { background:
url("//localhost/styles.css?quote=\'") }',
],
[
'Background URL (single quoted, containing
double quotes; T60473)',
'foo { background:
url(\'//localhost/styles.css?quote="\') }',
- 'foo { background:
url(\'//localhost/styles.css?quote="\') }',
+ 'foo { background:
url("//localhost/styles.css?quote=\"") }',
],
[
'Simple case with comments before url',
@@ -522,25 +522,15 @@
'url(data:image/png;base64,R0lGODlh/+==)',
],
[
- 'URL with single quotes',
+ 'URL with quotes',
"https://en.wikipedia.org/wiki/Wendy's",
-
"url('https://en.wikipedia.org/wiki/Wendy\\'s')",
- ],
- [
- 'URL with double quotes',
- 'https://en.wikipedia.org/wiki/""',
- "url('https://en.wikipedia.org/wiki/\"\"')",
+
"url(\"https://en.wikipedia.org/wiki/Wendy's\")",
],
[
'URL with parentheses',
'https://en.wikipedia.org/wiki/Boston_(band)',
-
"url('https://en.wikipedia.org/wiki/Boston_(band)')",
+
'url("https://en.wikipedia.org/wiki/Boston_(band)")',
],
- [
- 'URL with spaces',
- 'https://en.wikipedia.org/wiki/Foo bar',
- "url('https://en.wikipedia.org/wiki/Foo bar')"
- ]
];
}
--
To view, visit https://gerrit.wikimedia.org/r/381486
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8bd9af67aeb11cb478ba402205ce834b1bec17a7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.31.0-wmf.1
Gerrit-Owner: Catrope <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: VolkerE <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits