Project

General

Profile

Actions

Bug #101701

closed

PathUtility::getAbsoluteWebPath() create wrong asset path in composer with TYPO3 12

Added by Sven Juergens 9 months ago. Updated 7 days ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2023-08-16
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

There is an error in the path generation in connection with TYPO3 12 and PathUtility::getAbsoluteWebPath() in Composer.
if the asset path contains "Resources/Public" more than once.

Example:
- TYPO3 12 installation with composer
- Installing news
- Installation "sitepackage" (for example)
copy "news-basic.css" to sitepackage to the following path:
sitepackage/Resources/Public/ExtensionOverwrite/news/Resources/Public/Css/
then use this TypoScript

plugin.tx_news {
    settings {
        cssFile = EXT:sitepackage/Resources/Public/ExtensionOverwrite/news/Resources/Public/Css/news-basic.css
    }
}

Generated Path:

<link href="/_assets/bb36f0f8e61571e2a51d4a09a953e97d/ExtensionOverwrite/news/?1692215767" rel="stylesheet" >

Should:
<link href="/_assets/bb36f0f8e61571e2a51d4a09a953e97d/ExtensionOverwrite/news/Resources/Public/Css/news-basic.css?1692215826" rel="stylesheet" >

Problem is this line in in PathUtility::class
https://github.com/TYPO3/typo3/blob/d7f24355efc58fb6f749fd26214a3d43e9d0ed24/typo3/sysext/core/Classes/Utility/PathUtility.php#L69

Because "Resources/Public" occurs several times, a problem arises in connection with explode()
The problem could be solved with a limit in explode().

                [$relativePrefix, $relativeAssetPath] = explode('Resources/Public', $relativePath, 2);

Actions

Also available in: Atom PDF