Bug #93463
openReduction of affected attributes of the absRefPrefix function
0%
Description
TYPO3 9 / 10
Currently, undesired problems can occur with the absRefPrefix, which lead to HTML attributes being supplemented with the absRefPrefix "/", for example, although these attributes have nothing to do with URLs.
A client of mine (unfortunately) has a storage folder named / with the path "video" on the root level of the page. For this, the absRefPrefix is also set to "/".
This now leads to the fact that in the HTML output of the web page, every occurrence of "video/" in attributes is supplemented with a / at the beginning. For example, videos no longer work because the source tag then looks like this:
<source src="/fileadmin/test.mp4" type="/video/mp4"> instead of type="video/mp4" which means that the video no longer works.
Something similar would probably also happen with style or script tags with type="/text/javascript" if there were a storage folder with the name/path "text".
Therefore my recommendation: The function \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::setAbsRefPrefix
for setting the absRefPrefix in the TSFE should be sensitised. The str_replace should be adjusted to only affect known attributes like src, href etc. For this, there could perhaps be another option in the install tool to give users the option of specifying other attributes that may be affected by the absRefPrefix.
Updated by Georg Ringer almost 4 years ago
- Tracker changed from Feature to Bug
- Description updated (diff)
- Status changed from New to Accepted
- TYPO3 Version set to 9
Updated by Georg Ringer almost 4 years ago
Problem is code like this
/** @var StorageRepository $storageRepository */ $storageRepository = GeneralUtility::makeInstance(StorageRepository::class); $storages = $storageRepository->findAll(); foreach ($storages as $storage) { if ($storage->getDriverType() === 'Local' && $storage->isPublic() && $storage->isOnline()) { $folder = $storage->getPublicUrl($storage->getRootLevelFolder(), true); $search[] = '"' . $folder; $replace[] = '"' . $this->absRefPrefix . $folder; } }