From 3b44d0610149cd7e95c26348f16f3f9278c7b761 Mon Sep 17 00:00:00 2001 From: Lars Michalowski Date: Thu, 17 Mar 2022 09:00:12 +0100 Subject: [PATCH] [BUGFIX] Ensure imageLinkWrap works with UTF-8 filenames The unset($info['originalFile']) introduced in #90565 broke an access to that array key below in the method. This leads to the situation that files with UTF-8 characters are not found anymore since the imageLinkWrap() method is fed with an encoded version of the filename and not the original file object anymore. The patch parks $info['originalFile'] in a variable to access it for imageLinkWrap() again. Releases: main, 11.5 Resolves: #93716 Resolves: #90757 Related: #90565 Change-Id: I2471283bd6825c093745b2331a12737de00c105f Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74116 Tested-by: core-ci Tested-by: Christian Kuhn Reviewed-by: Christian Kuhn --- .../frontend/Classes/ContentObject/ImageContentObject.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/typo3/sysext/frontend/Classes/ContentObject/ImageContentObject.php b/typo3/sysext/frontend/Classes/ContentObject/ImageContentObject.php index 0b9b2c54e17e..d0b7dc40b84d 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ImageContentObject.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ImageContentObject.php @@ -69,6 +69,7 @@ protected function cImage($file, $conf) $source = $info[3]; } // Remove file objects for AssetCollector, as it only allows to store scalar values + $infoOriginalFile = $info['originalFile']; unset($info['originalFile'], $info['processedFile']); GeneralUtility::makeInstance(AssetCollector::class)->addMedia( $source, @@ -103,7 +104,7 @@ protected function cImage($file, $conf) if ($linkWrap !== '') { $theValue = $this->linkWrap((string)$theValue, $linkWrap); } elseif ($conf['imageLinkWrap'] ?? false) { - $originalFile = !empty($info['originalFile']) ? $info['originalFile'] : $info['origFile']; + $originalFile = !empty($infoOriginalFile) ? $infoOriginalFile : urldecode($info['origFile']); $theValue = $this->cObj->imageLinkWrap($theValue, $originalFile, $conf['imageLinkWrap.']); } $wrap = $this->cObj->stdWrapValue('wrap', $conf ?? []);