Commit 4431c7e1 authored by alexpott's avatar alexpott

Issue #2014851 by hlieberman, Wim Leers: Fixed Drupal CSS preprocessing breaks...

Issue #2014851 by hlieberman, Wim Leers: Fixed Drupal CSS preprocessing breaks protocol-relative paths.
parent 8cfc089e
......@@ -205,7 +205,7 @@ protected function processCss($contents, $optimize = FALSE) {
// Replaces @import commands with the actual stylesheet content.
// This happens recursively but omits external files.
$contents = preg_replace_callback('/@import\s*(?:url\(\s*)?[\'"]?(?![a-z]+:)([^\'"\()]+)[\'"]?\s*\)?\s*;/', array($this, 'loadNestedFile'), $contents);
$contents = preg_replace_callback('/@import\s*(?:url\(\s*)?[\'"]?(?![a-z]+:)(?!\/\/)([^\'"\()]+)[\'"]?\s*\)?\s*;/', array($this, 'loadNestedFile'), $contents);
return $contents;
}
......
......@@ -112,6 +112,8 @@ function testOptimizeProvider() {
// - A background image with relative paths, which must be rewritten.
// - The rewritten background image path must also be passed through
// file_create_url(). (https://drupal.org/node/1961340)
// - Imported files that are external (protocol-relative URL or not)
// should not be expanded. (https://drupal.org/node/2014851)
1 => array(
array(
'group' => -100,
......
......@@ -2,6 +2,8 @@
@import "import1.css";
@import "import2.css";
@import url("http://example.com/style.css");
@import url("//example.com/style.css");
body {
margin: 0;
......
ul,select{font:1em/160% Verdana,sans-serif;color:#494949;}.ui-icon{background-image:url(images/icon.png);}
p,select{font:1em/160% Verdana,sans-serif;color:#494949;}
body{margin:0;padding:0;background:#edf5fa;font:76%/170% Verdana,sans-serif;color:#494949;}.this .is .a .test{font:1em/100% Verdana,sans-serif;color:#494949;}.this
@import url("http://example.com/style.css");@import url("//example.com/style.css");body{margin:0;padding:0;background:#edf5fa;font:76%/170% Verdana,sans-serif;color:#494949;}.this .is .a .test{font:1em/100% Verdana,sans-serif;color:#494949;}.this
.is
.a
.test{font:1em/100% Verdana,sans-serif;color:#494949;}textarea,select{font:1em/160% Verdana,sans-serif;color:#494949;}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment