X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Flibs%2FCSSMin.php;h=ee88d0d2b50ef57f4df5a6c4e79c4f1cf19a2e23;hb=5fa4cdf860c79b32ab6ef034c6d9420c2727f695;hp=cd80066558ed09b3efdf2f70716895515fe92788;hpb=a00e369aff80b2b338f26829b27cdeb8c66bf291;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/CSSMin.php b/includes/libs/CSSMin.php index cd80066558..ee88d0d2b5 100644 --- a/includes/libs/CSSMin.php +++ b/includes/libs/CSSMin.php @@ -142,7 +142,15 @@ class CSSMin { if ( preg_match( '/^[\r\n\t\x20-\x7e]+$/', $contents ) ) { // Do not base64-encode non-binary files (sane SVGs). // (This often produces longer URLs, but they compress better, yielding a net smaller size.) - $uri = 'data:' . $type . ',' . rawurlencode( $contents ); + $encoded = rawurlencode( $contents ); + // Unencode some things that don't need to be encoded, to make the encoding smaller + $encoded = strtr( $encoded, [ + '%20' => ' ', // Unencode spaces + '%2F' => '/', // Unencode slashes + '%3A' => ':', // Unencode colons + '%3D' => '=', // Unencode equals signs + ] ); + $uri = 'data:' . $type . ',' . $encoded; if ( !$ie8Compat || strlen( $uri ) < self::DATA_URI_SIZE_LIMIT ) { return $uri; }