summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-01-07 07:45:03 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-01-07 07:45:03 +0000
commit436ddca9fbf0eb955a06b5262e8f2ba1e9d25afd (patch)
treee581a6713185f02be31cb7109769d6c7f84f13b2 /includes
parent1407c81632b6279c550a07f8f1b08120f19f344d (diff)
downloadbrdo-436ddca9fbf0eb955a06b5262e8f2ba1e9d25afd.tar.gz
brdo-436ddca9fbf0eb955a06b5262e8f2ba1e9d25afd.tar.bz2
#265719 by kkaefer, JacobSingh, ksenzee, and rfay: Fixed CSS aggregator produces invalid code and directory names for @import files which breaks IE (with tests).
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc13
1 files changed, 11 insertions, 2 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 6d69a18dd..4abd62b1b 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -3497,8 +3497,17 @@ function _drupal_load_stylesheet($matches) {
$filename = $matches[1];
// Load the imported stylesheet and replace @import commands in there as well.
$file = drupal_load_stylesheet($filename);
- // Alter all url() paths, but not external.
- return preg_replace('/url\(([\'"]?)(?![a-z]+:)([^\'")]+)[\'"]?\)?;/i', 'url(\1' . dirname($filename) . '/', $file);
+
+ // Determine the file's directory.
+ $directory = dirname($filename);
+ // If the file is in the current directory, make sure '.' doesn't appear in
+ // the url() path.
+ $directory = $directory == '.' ? '' : $directory .'/';
+
+ // Alter all internal url() paths. Leave external paths alone. We don't need
+ // to normalize absolute paths here (i.e. remove folder/... segments) because
+ // that will be done later.
+ return preg_replace('/url\s*\(([\'"]?)(?![a-z]+:|\/+)/i', 'url(\1'. $directory, $file);
}
/**