From 9d9d394062a2d502c5340e025a614d268147f4b9 Mon Sep 17 00:00:00 2001
From: Wouter Wolters <typo3@wouterwolters.nl>
Date: Thu, 1 Dec 2016 22:35:55 +0100
Subject: [PATCH] Revert "[BUGFIX] ResourceCompressor must deal with absolute
 web paths"

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>
---
 .../core/Classes/Resource/ResourceCompressor.php    | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/typo3/sysext/core/Classes/Resource/ResourceCompressor.php b/typo3/sysext/core/Classes/Resource/ResourceCompressor.php
index a8fbffbdd3eb..91359ef0c14e 100644
--- a/typo3/sysext/core/Classes/Resource/ResourceCompressor.php
+++ b/typo3/sysext/core/Classes/Resource/ResourceCompressor.php
@@ -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
-- 
GitLab