Commit 1d65ffe0 authored by Markus Klein's avatar Markus Klein Committed by Wouter Wolters
Browse files

[BUGFIX] ResourceCompressor must deal with absolute web paths

ResourceCompressor lacks the ability to compress files which are
registered with their absolute web path (as FormEngine does).
Add a check to resolve such paths correctly.

Resolves: #78803
Releases: master
Change-Id: Id42b0889243e898dfb01a018974e5db51675a15b
Reviewed-on: https://review.typo3.org/50782

Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: default avatarJoerg Boesche <typo3@joergboesche.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
parent 553681a2
......@@ -419,9 +419,16 @@ 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 . ltrim($filename, '/'))) {
return ltrim($filename, '/');
if (is_file($this->rootPath . $fileNameWithoutSlash)) {
return $fileNameWithoutSlash;
}
// if the file is from a special TYPO3 internal directory, add the missing typo3/ prefix
if (is_file(realpath(PATH_site . TYPO3_mainDir . $filename))) {
......@@ -433,7 +440,7 @@ class ResourceCompressor
} elseif (strpos($filename, '../') === 0) {
$file = GeneralUtility::resolveBackPath(PATH_typo3 . $filename);
} else {
$file = PATH_site . ltrim($filename, '/');
$file = PATH_site . $fileNameWithoutSlash;
}
// check if the file exists, and if so, return the path relative to TYPO3_mainDir
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment