[BUGFIX] Do not prefix FAL file links with absRefPrefix 80/52380/3
authorHelmut Hummel <typo3@helhum.io>
Thu, 6 Apr 2017 20:31:36 +0000 (22:31 +0200)
committerHelmut Hummel <typo3@helhum.io>
Tue, 11 Apr 2017 09:20:57 +0000 (11:20 +0200)
When using an external FAL storage the public URLs of files contain a scheme.
Check for the scheme before prefixing with absRefPrefix
in file link builder.

Resolves: #80740
Releases: 7.6, master
Change-Id: I98c1027931f6c4c05561e35d1d7938aefd66eda0
Reviewed-on: https://review.typo3.org/52380
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Manuel Selbach <manuel_selbach@yahoo.de>
Tested-by: Manuel Selbach <manuel_selbach@yahoo.de>
Reviewed-by: Helmut Hummel <typo3@helhum.io>
Tested-by: Helmut Hummel <typo3@helhum.io>
typo3/sysext/frontend/Classes/Typolink/FileOrFolderLinkBuilder.php

index c8ee336..3716d34 100644 (file)
@@ -43,7 +43,11 @@ class FileOrFolderLinkBuilder extends AbstractTypolinkBuilder
         $linkLocation = $fileOrFolderObject->getPublicUrl();
         // Setting title if blank value to link
         $linkText = $this->parseFallbackLinkTextIfLinkTextIsEmpty($linkText, rawurldecode($linkLocation));
-        $linkLocation = (strpos($linkLocation, '/') !== 0 ? $tsfe->absRefPrefix : '') . $linkLocation;
+        if (strpos($linkLocation, '/') !== 0
+            && parse_url($linkLocation, PHP_URL_SCHEME) === null
+        ) {
+            $linkLocation = $tsfe->absRefPrefix . $linkLocation;
+        }
         $url = $this->processUrl(UrlProcessorInterface::CONTEXT_FILE, $linkLocation, $conf);
         return [
             $this->forceAbsoluteUrl($url, $conf),