Bug #14271
closedprefixRelPath incorrectly prefixes absolute urls
0%
Description
Problem:
URL's with a leading slash are absolute and should not be prefixed as though they were relative. The prefixRelPath function adds the template path (eg, /fileadmin/templates/current/) to the absolute url of /about/ resulting in an invalid (and non-existent) url of /fileadmin/templates/current//about/ (notice the double // before about)
prefixRelPath uses the built-in PHP function 'parse_url' to discover the 'scheme' (http, ftp, etc) of the URL to be prefixed. In the case of a URL with a leading / there is no 'scheme' value returned.
Solution:
One solution is to modify the function to include a simple check if the leading character of the url to be cleaned is a slash. Line 888 of typo3_src-3.6.2/t3lib/class.t3lib_parsehtml.original.php reads:
if (!$pU['scheme']) { // If not an absolute URL.
But could read:
if (!$pU['scheme'] && substr($srcVal, 0, 1)!='/') { // If not an absolute URL.
RedHat Linux EL 3.0
Typo3 SRC 3.6.2
AliasPRO extension (and others, this is the only one that is relevant)
(issue imported from #M288)
Updated by Lyle E over 20 years ago
I wasn't sure if I should select backend or front-end. It effects the backend during template building with TemplaVoila and the Front End when rendering TypoLinks.
Updated by Ingmar Schlecht about 20 years ago
This is fixed in CVS now and will be in Typo3 3.7.0
Updated by Lyle E about 20 years ago
Sounds great, thanks for taking my small patch.
What's the close procedure for these bugs? I'm new to the Typo3 development community.
Updated by Ingmar Schlecht about 20 years ago
I have to thank you for your patch! :-)
I'm now setting the status of this bug to resolved.