Bug #48529
closed
typolink cannot create absolute links to local files even if forceAbsoluteUrl property is set
Added by Michael Klapper over 11 years ago.
Updated about 6 years ago.
Description
In "tslib_content::forceAbsoluteUrl" is a regular expression used to extract the url parts of the given $url. Unfortunately the pattern does not take care of file links since it detects the following (wrong) url parts.
Given URL "fileadmin/some/file.pdf"
array (size=4)
'scheme' => string ''
'delimiter' => string '://'
'host' => string 'fileadmin'
'path' => string '/some/file.pdf'
The build in function "parse_url" did it like:
array (size=1)
'path' => string 'fileadmin/some/file.pdf'
Some test code:
page = PAGE
page {
dokType = 0
1112220 = COA
1112220 {
5 = TEXT
5.value = FORCED ABSOLUTE URL:
10 = TEXT
10 {
typolink {
parameter.data = page:uid
forceAbsoluteUrl = 1
forceAbsoluteUrl.scheme = https
returnLast = url
}
wrap = [|],
}
20 < .10
20.typolink.parameter >
20.typolink.parameter = /
30 < .20
# this file link is expected to be absolute prefixed!
30.typolink.parameter = fileadmin/some/file.pdf
}
20 < .10
20.5.value = REGULAR:
20.10.typolink.forceAbsoluteUrl >
}
- Status changed from New to Under Review
I can confirm the issue, but there is a very easy workaround: prefix the relative path with a slash.
But I agree this is simply not consistent, since if you don't use forceAbsoluteUrl
you must not specify this slash.
Example for clarifying the problem even more.
Assumed URL of the site: http://devserver/
page.20 = TEXT
page.20.value = demolink
page.20.typolink.parameter = fileadmin/dummy.jpg
Gives href="fileadmin/dummy.jpg"
page.20 = TEXT
page.20.value = demolink
page.20.typolink.parameter = fileadmin/dummy.jpg
page.20.typolink.forceAbsoluteUrl = 1
Gives href="fileadmin/dummy.jpg"
page.20 = TEXT
page.20.value = demolink
page.20.typolink.parameter = /fileadmin/dummy.jpg
page.20.typolink.forceAbsoluteUrl = 1
Gives href="http://devserver/fileadmin/dummy.jpg"
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/21036
Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/21036
Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/21036
Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/21036
Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/21036
Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/21036
Patch set 11 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/21036
Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34411
Patch set 2 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34411
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF