From: Brion Vibber Date: Tue, 10 May 2011 20:14:30 +0000 (+0000) Subject: * (bug 25262) Fix for minification of hardcoded data: URIs in CSS X-Git-Tag: 1.31.0-rc.0~30292 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%22id_auteur=%24connect_id_auteur%22%29%20.%20%22?a=commitdiff_plain;h=5feb09f086c524611730ed2677c78387f36e7727;p=lhc%2Fweb%2Fwiklou.git * (bug 25262) Fix for minification of hardcoded data: URIs in CSS CSSMin::minify()'s processing of url references for path adjustment or embedding had excluded explicit fully-qualified http: and https: URLs, but was damaging others such as data: URIs that were actually hardcoded into the original CSS. This was affecting styles used on no.wikipedia.org which embedded a few icons directly into the style sheet. Now checking for any URL scheme rather than hardcoding a check for http & https. --- diff --git a/RELEASE-NOTES-1.18 b/RELEASE-NOTES-1.18 index 649619b6d1..cf3163ac9b 100644 --- a/RELEASE-NOTES-1.18 +++ b/RELEASE-NOTES-1.18 @@ -250,6 +250,7 @@ production. * (bug 28076) Thumbnail height limited to 360 pixels on Special:Listfiles * (bug 22227) Special:Listfiles no longer throws an error on bogus file entries * (bug 19408) user_properties.up_property: 32 bytes is not enough. +* (bug 25262) Fix for minification of hardcoded data: URIs in CSS === API changes in 1.18 === * (bug 26339) Throw warning when truncating an overlarge API result. diff --git a/includes/libs/CSSMin.php b/includes/libs/CSSMin.php index ad65d24435..c0e7811273 100644 --- a/includes/libs/CSSMin.php +++ b/includes/libs/CSSMin.php @@ -120,8 +120,9 @@ class CSSMin { self::URL_REGEX . '(?P[^;]*)[\;]?/'; $offset = 0; while ( preg_match( $pattern, $source, $match, PREG_OFFSET_CAPTURE, $offset ) ) { - // Skip absolute URIs - if ( preg_match( '/^https?:\/\//', $match['file'][0] ) ) { + // Skip fully-qualified URLs and data URIs + $urlScheme = parse_url( $match['file'][0], PHP_URL_SCHEME ); + if ( $urlScheme ) { // Move the offset to the end of the match, leaving it alone $offset = $match[0][1] + strlen( $match[0][0] ); continue;