VolkerE has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/403577 )
Change subject: Re-introduce CSSMin: Improve encoding of quotes in embedded SVGs
......................................................................
Re-introduce CSSMin: Improve encoding of quotes in embedded SVGs
When a URL (data: or otherwise) contains quotes, wrap it in
double quotes ("). This then allows us to encode
double quotes (") as single quotes (') in the data URI embedding of SVGs.
This time in the right way only with valid URL characters, working with
IE 11 and Edge.
Bug: T175318
Change-Id: I1d2a36f28e736fb624c298cf64c1e36f2283a32c
---
M includes/libs/CSSMin.php
M tests/phpunit/includes/libs/CSSMinTest.php
2 files changed, 3 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/77/403577/1
diff --git a/includes/libs/CSSMin.php b/includes/libs/CSSMin.php
index 20f52f8..1cd243f 100644
--- a/includes/libs/CSSMin.php
+++ b/includes/libs/CSSMin.php
@@ -149,6 +149,7 @@
'%0A' => ' ', // Change newlines to spaces
'%0D' => ' ', // Change carriage returns to
spaces
'%09' => ' ', // Change tabs to spaces
+ '%22' => "'", // Unencode double quotes
] );
// Consolidate runs of multiple spaces in a row
$encoded = preg_replace( '/ {2,}/', ' ', $encoded );
diff --git a/tests/phpunit/includes/libs/CSSMinTest.php
b/tests/phpunit/includes/libs/CSSMinTest.php
index a1b9393..821fbfb 100644
--- a/tests/phpunit/includes/libs/CSSMinTest.php
+++ b/tests/phpunit/includes/libs/CSSMinTest.php
@@ -271,8 +271,8 @@
// 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,%3Csvg
xmlns=%22http://www.w3.org/2000/svg%22 width=%228'
- . '%22 height=%228%22%3E %3Ccircle cx=%224%22
cy=%224%22 r=%222%22/%3E %3C/svg%3E';
+ $svg = "data:image/svg+xml,%3Csvg
xmlns='http://www.w3.org/2000/svg' width='8'"
+ . "height='8'%3E %3Ccircle cx='4' cy='4' r='2'/%3E
%3C/svg%3E";
// phpcs:disable Generic.Files.LineLength
return [
--
To view, visit https://gerrit.wikimedia.org/r/403577
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1d2a36f28e736fb624c298cf64c1e36f2283a32c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: VolkerE <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits