From 436ddca9fbf0eb955a06b5262e8f2ba1e9d25afd Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Thu, 7 Jan 2010 07:45:03 +0000 Subject: #265719 by kkaefer, JacobSingh, ksenzee, and rfay: Fixed CSS aggregator produces invalid code and directory names for @import files which breaks IE (with tests). --- includes/common.inc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'includes') 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); } /** -- cgit v1.2.3