Skip to content

Commit

Permalink
[BUGFIX] Ensure imageLinkWrap works with UTF-8 filenames
Browse files Browse the repository at this point in the history
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 <typo3@b13.com>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
  • Loading branch information
Lars Michalowski authored and lolli42 committed Mar 29, 2022
1 parent 16f3c51 commit 3b44d06
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -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,
Expand Down Expand Up @@ -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 ?? []);
Expand Down

0 comments on commit 3b44d06

Please sign in to comment.