[BUGFIX] Do not encode links from non-local storages 86/23786/4
authorHelmut Hummel <helmut.hummel@typo3.org>
Thu, 12 Sep 2013 12:39:26 +0000 (14:39 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Tue, 5 Nov 2013 13:48:06 +0000 (14:48 +0100)
The check for non file URLs that was introduced
in #42223 does not take relative URLs into account,
which are also perfectly valid for some drivers.

Just check if the image resource URL is a local
file, because only then it makes sense to maybe
transform it to a GIF.

We also remove an obsolete check for file
in imageLinkWrap as the URL there can be either
an URL to a remote storage or an integer.

Related: #42223
Resolves: #51949
Releases: 6.0, 6.1, 6.2
Change-Id: I67c8cea1c3b4997558b99d244bae5ea6d509f923
Reviewed-on: https://review.typo3.org/23786
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php

index 01f49d1..016d597 100644 (file)
@@ -1329,7 +1329,7 @@ class ContentObjectRenderer {
                $info = $this->getImgResource($file, $conf['file.']);
                $GLOBALS['TSFE']->lastImageInfo = $info;
                if (is_array($info)) {
-                       if (GeneralUtility::isAllowedAbsPath(PATH_site . $info['3'])) {
+                       if (is_file(PATH_site . $info['3'])) {
                                $source = GeneralUtility::rawUrlEncodeFP(GeneralUtility::png_to_gif_by_imagemagick($info[3]));
                                $source = $GLOBALS['TSFE']->absRefPrefix . $source;
                        } else {
@@ -1518,8 +1518,8 @@ class ContentObjectRenderer {
                        if (isset($conf['file.'])) {
                                $imageFile = $this->stdWrap($imageFile, $conf['file.']);
                        }
-                       // imageFileLink:
-                       if ($content == $string && @is_file($imageFile)) {
+                       // Create imageFileLink if not created with typolink
+                       if ($content == $string) {
                                $parameterNames = array('width', 'height', 'effects', 'alternativeTempPath', 'bodyTag', 'title', 'wrap');
                                $parameters = array();
                                $sample = isset($conf['sample.']) ? $this->stdWrap($conf['sample'], $conf['sample.']) : $conf['sample'];
@@ -8080,4 +8080,4 @@ class ContentObjectRenderer {
        protected function getResourceFactory() {
                return \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance();
        }
-}
\ No newline at end of file
+}