Issue Bug Closed

#48529typolink cannot create absolute links to local files even if forceAbsoluteUrl property is set

Michael Klapper 05/25/13, 12:25 updated 10/02/18, 12:14

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 >
}

Reviews 2