Revert "[BUGFIX] ResourceCompressor must deal with absolute web paths" 43/50843/3
authorWouter Wolters <typo3@wouterwolters.nl>
Thu, 1 Dec 2016 21:35:55 +0000 (22:35 +0100)
committerSusanne Moog <susanne.moog@typo3.org>
Fri, 2 Dec 2016 08:52:49 +0000 (09:52 +0100)
This reverts commit 1d65ffe0f772e56dc0e19b8ffc84bf1a498cbbfd.

Resolves: #78856
Related: #78803
Change-Id: I5ef82b6b5c32de798b6d2677bc9a6dd6089d386a
Reviewed-on: https://review.typo3.org/50843
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Gianluigi Martino <gmartino27@gmail.com>
Tested-by: Gianluigi Martino <gmartino27@gmail.com>
Reviewed-by: Alexander Rothmund <alexander@rothmund.ch>
Tested-by: Alexander Rothmund <alexander@rothmund.ch>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/core/Classes/Resource/ResourceCompressor.php

index a8fbffb..91359ef 100644 (file)
@@ -419,16 +419,9 @@ class ResourceCompressor
      */
     protected function getFilenameFromMainDir($filename)
     {
-        $docRoot = GeneralUtility::getIndpEnv('TYPO3_DOCUMENT_ROOT');
-        $fileNameWithoutSlash = ltrim($filename, '/');
-
-        // if the file exists in the document root
-        if (is_file($docRoot . '/' . $fileNameWithoutSlash)) {
-            return substr($docRoot . '/' . $fileNameWithoutSlash, strlen($this->rootPath));
-        }
         // if the file exists in the root path, just return the $filename
-        if (is_file($this->rootPath . $fileNameWithoutSlash)) {
-            return $fileNameWithoutSlash;
+        if (is_file($this->rootPath . ltrim($filename, '/'))) {
+            return ltrim($filename, '/');
         }
         // if the file is from a special TYPO3 internal directory, add the missing typo3/ prefix
         if (is_file(realpath(PATH_site . TYPO3_mainDir . $filename))) {
@@ -440,7 +433,7 @@ class ResourceCompressor
         } elseif (strpos($filename, '../') === 0) {
             $file = GeneralUtility::resolveBackPath(PATH_typo3 . $filename);
         } else {
-            $file = PATH_site . $fileNameWithoutSlash;
+            $file = PATH_site . ltrim($filename, '/');
         }
 
         // check if the file exists, and if so, return the path relative to TYPO3_mainDir