[BUGFIX] t3lib_Compressor breaks absolute paths in CSS
authorAndreas Bouche <bouche@flagbit.de>
Mon, 19 Sep 2011 09:23:20 +0000 (11:23 +0200)
committerXavier Perseguers <xavier@typo3.org>
Tue, 20 Sep 2011 12:44:09 +0000 (14:44 +0200)
Adds a negative lookahead for trailing slash to the regular
Expressions in method "cssFixRelativeUrlPaths" to exclude
absolute paths from being rewritten.

Change-Id: I36355f46da53d167a9fb318228383a6181920398
Resolves: #29904
Releases: 4.6, 4.5, 4.4
Reviewed-on: http://review.typo3.org/5051
Reviewed-by: Dmitry Dulepov
Tested-by: Dmitry Dulepov
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
t3lib/class.t3lib_compressor.php

index 76aa9a8..ec560c9 100644 (file)
@@ -539,13 +539,13 @@ class t3lib_Compressor {
 
                        // Replace "url()" paths
                if (stripos($contents, 'url') !== FALSE) {
-                       $regex = '/url(\(\s*["\']?([^"\']+)["\']?\s*\))/iU';
+                       $regex = '/url(\(\s*["\']?(?!\/)([^"\']+)["\']?\s*\))/iU';
                        $contents = $this->findAndReplaceUrlPathsByRegex($contents, $regex, $newDir, '(\'|\')');
                }
 
                        // Replace "@import" paths
                if (stripos($contents, '@import') !== FALSE) {
-                       $regex = '/@import\s*(["\']?([^"\']+)["\']?)/i';
+                       $regex = '/@import\s*(["\']?(?!\/)([^"\']+)["\']?)/i';
                        $contents = $this->findAndReplaceUrlPathsByRegex($contents, $regex, $newDir, '"|"');
                }