[BUGFIX] Correct path for resources in compressed CSS files 48/41848/8
authorMarkus Klein <markus.klein@typo3.org>
Wed, 22 Jul 2015 19:13:35 +0000 (21:13 +0200)
committerSusanne Moog <typo3@susannemoog.de>
Thu, 23 Jul 2015 10:00:24 +0000 (12:00 +0200)
This fixes wrong paths in CSS files not being concatenated
but compressed like ExtJS theme.

Test with BE|debug = 0.
rm -f typo3temp/compressor/*

Releases: master
Resolves: #68475
Change-Id: I4e875c930524a7f4249aa6576274ea34381a10e7
Reviewed-on: http://review.typo3.org/41848
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Susanne Moog <typo3@susannemoog.de>
Tested-by: Susanne Moog <typo3@susannemoog.de>
typo3/sysext/core/Classes/Resource/ResourceCompressor.php

index 6cd700b..0cd424b 100644 (file)
@@ -417,11 +417,8 @@ class ResourceCompressor {
                // only create it, if it doesn't exist, yet
                if (!file_exists((PATH_site . $targetFile)) || $this->createGzipped && !file_exists((PATH_site . $targetFile . '.gzip'))) {
                        $contents = $this->compressCssString(GeneralUtility::getUrl($filenameAbsolute));
-                       // we have to fix relative paths, if we aren't working on a file in our target directory
-                       $relativeFilename = str_replace(PATH_site, '', $filenameAbsolute);
-                       if (strpos($relativeFilename, $this->targetDirectory) === FALSE) {
-                               $filenameRelativeToMainDir = substr($relativeFilename, strlen($this->backPath));
-                               $contents = $this->cssFixRelativeUrlPaths($contents, PathUtility::dirname($filenameRelativeToMainDir) . '/');
+                       if (strpos($filename, $this->targetDirectory) === FALSE) {
+                               $contents = $this->cssFixRelativeUrlPaths($contents, PathUtility::dirname($filename) . '/');
                        }
                        $this->writeFileAndCompressed($targetFile, $contents);
                }