Issue Bug Closed

#14271prefixRelPath incorrectly prefixes absolute urls

Lyle E 08/14/04, 03:12 updated 08/12/06, 14:27

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)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.