#93463Reduction of affected attributes of the absRefPrefix function
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:
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.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
History 3
-
Georg Ringer changed tracker
FeatureBug description statusNewAccepted TYPO3 Version 9 <span data-processor="relativetime" data-value="2021-02-09T05:33:06+00:00" > 02/09/21, 05:33 </span> -
Georg Ringer commented and changed status
AcceptedClosed <span data-processor="relativetime" data-value="2026-10-16T15:57:04+00:00" > 10/16/26, 15:57 </span>I suggest to close this issue.
The global search and replace on the generated frontend content, which prefixed resources with
config.absRefPrefixand caused the described false positives liketype="/video/mp4", has been removed in v14 (see #108114). Resource URLs are now prefixed when they are generated, via the System Resource API (see #107537), so arbitrary attribute values are no longer touched. This also obsoletes$GLOBALS['TYPO3_CONF_VARS']['FE']['additionalAbsRefPrefixDirectories'].TypoScriptFrontendController::setAbsRefPrefix()does not exist anymore.
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; } }