ericmckean / minify

Automatically exported from code.google.com/p/minify
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

data URL scheme not supported (Fix supplied) #80

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Minify version: 2.1.1
PHP version: 5.2.6

What steps will reproduce the problem?
1. Create a CSS file with the following code

#prevLink{ height: 100%; background-image: url(data:image/gif;base64,AAAA);
display: block; }

2. Run this through minify
3. Output will have changed the URL to the full path (e.g. as follows)

#prevLink{ height: 100%; background-image:
url(/path/to/directory/data:image/gif;base64,AAAA); display: block; }

Expected output:

#prevLink{ height: 100%; background-image: url(data:image/gif;base64,AAAA);
display: block; }

Actual output:

#prevLink{ height: 100%; background-image:
url(/path/to/directory/data:image/gif;base64,AAAA); display: block; }

Did any unit tests FAIL?

Didn't test them.

Please provide any additional information below.

Following fixed the issue for me.
min/lib/Minify/CSS.php
~line 275 change

            if (strpos($url, '//') > 0) {
                // probably starts with protocol, do not alter
            } else {

to

            if (strpos($url, '//') > 0) {
                // probably starts with protocol, do not alter
            /**
             * Fixing bug in minify that breaks
url(data:image/gif;base64,AAAA);
             */
            } else if( preg_match( "#^data:(.+?)/(.+?);base64,#i", $url ) ) {
                // This is a data: scheme and not a path
            } else {

Original issue reported on code.google.com by brandon....@gmail.com on 23 Jan 2009 at 7:31

GoogleCodeExporter commented 9 years ago
Fixed in R279

Original comment by mrclay....@gmail.com on 25 Jan 2009 at 4:23

GoogleCodeExporter commented 9 years ago
Nice thx 

Original comment by blac...@gmail.com on 22 Feb 2009 at 9:03