Project

General

Profile

Actions

Bug #82486

closed

IncludeJS* / includeCSS* (including compression / concatenation) ignoring absRefPrefix

Added by Jens Engelmann over 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
-
Target version:
-
Start date:
2017-09-14
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

The includeJS and includeCSS functions in typoscript are ignoring the given absRefPrefix.

I tested this on a fresh installation of TYPO3 8.7.6 with the following typoscript code:

config {
  absRefPrefix = /foo/
  compressJs = 1
}

page = PAGE
page {
  10 = TEXT
  10.value = HELLO WORLD!
  # setting a link to test if absRefPrefix works
  10.typolink.parameter = 1

  includeJSLibs.js1 = fileadmin/js1.js
  includeJSLibs.js2 = fileadmin/js2.js

  includeCSS.css1 = fileadmin/css1.css
  includeCSSLibs.css1 = fileadmin/css1.css
}

This gives me the following html output on the generated page:

<link rel="stylesheet" type="text/css" href="/fileadmin/css1.css?1505384618" media="all">
<link rel="stylesheet" type="text/css" href="/fileadmin/css1.css?1505384618" media="all">
<script src="/typo3temp/assets/compressed/js1-5130fdbc94c8b9e6f1802cab56df2b78.js?1505384940" type="text/javascript"></script>
<script src="/typo3temp/assets/compressed/js2-2a2ef88a17be994adbe3c851da68f8fe.js?1505384940" type="text/javascript"></script>

The sources do get a prefix - but it's "/" instead of the declared absRefPrefix "/foo/".

The test link on the other hand is generated correctly:

<a href="/foo/index.php?id=1">HELLO WORLD!</a>


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #77722: absRefPrefix is not applied everywhereClosed2016-08-31

Actions
Is duplicate of TYPO3 Core - Bug #83630: Config.absRefPrefix not working anymore for includeCSS, includeJs, includeJSLibs, includeCSSLibs after update to 8.7.9Closed2018-01-21

Actions
Actions #1

Updated by Rémy DANIEL over 6 years ago

  • Related to Bug #77722: absRefPrefix is not applied everywhere added
Actions #2

Updated by Klaus Moser over 6 years ago

Same issue here. I think this is caused by TYPO3\CMS\Core\Utility\PathUtility:getAbsoluteWebPath().
The method makes a path absolute by adding GeneralUtility::getIndpEnv('TYPO3_SITE_PATH') and ignores the configured absRefPrefix.

I don't know if there is a better way to get the configured absRefPrefix, but this could fix the issue:

if (isset($GLOBALS['TSFE']->config['config']['absRefPrefix']) && !empty($GLOBALS['TSFE']->config['config']['absRefPrefix'])) {
    $targetPath = rtrim($GLOBALS['TSFE']->config['config']['absRefPrefix'], '/') . '/' . $targetPath;
} else {
    $targetPath = GeneralUtility::getIndpEnv('TYPO3_SITE_PATH') . $targetPath;
}
Actions #3

Updated by Adrien Jacob about 6 years ago

Thanks a lot for the suggested fix, it did the job for me...

Actions #4

Updated by Riccardo De Contardi about 6 years ago

  • Related to Bug #83630: Config.absRefPrefix not working anymore for includeCSS, includeJs, includeJSLibs, includeCSSLibs after update to 8.7.9 added
Actions #5

Updated by Markus Klein about 6 years ago

  • Is duplicate of Bug #83630: Config.absRefPrefix not working anymore for includeCSS, includeJs, includeJSLibs, includeCSSLibs after update to 8.7.9 added
Actions #6

Updated by Markus Klein about 6 years ago

  • Related to deleted (Bug #83630: Config.absRefPrefix not working anymore for includeCSS, includeJs, includeJSLibs, includeCSSLibs after update to 8.7.9)
Actions #7

Updated by Markus Klein about 6 years ago

  • Status changed from New to Closed

Closing this as duplicate.

Actions

Also available in: Atom PDF