Project

General

Profile

Actions

Bug #93463

open

Reduction of affected attributes of the absRefPrefix function

Added by Paul Beck about 3 years ago. Updated about 3 years ago.

Status:
Accepted
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2021-02-08
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

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.

Actions #1

Updated by Georg Ringer about 3 years ago

  • Tracker changed from Feature to Bug
  • Description updated (diff)
  • Status changed from New to Accepted
  • TYPO3 Version set to 9
Actions #2

Updated by Georg Ringer about 3 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;
    }
}
Actions

Also available in: Atom PDF