Bug #93716
closedProblems with UTF-8 filenames, in cImage the imageLinkWrap gets the public path as identifier
100%
Description
Hi,
we have noticed that there is a problem with uft8 filenames of images when they are processed using imageLinkWrap.
The problem starts in the method TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::getImgResource:
public function getImgResource($file, $fileArray) { ... 'origFile' => $fileObject->getPublicUrl(), // <<<<------ 'origFile_mtime' => $fileObject->getModificationTime(), // This is needed by \TYPO3\CMS\Frontend\Imaging\GifBuilder, // in order for the setup-array to create a unique filename hash. 'originalFile' => $fileObject, 'processedFile' => $processedFileObject ...
The value $info['originalFile'] will be removed later in the method TYPO3\CMS\Frontend\ContentObject\ImageContentObject::cImage:
... // Remove file objects for AssetCollector, as it only allows to store scalar values unset($info['originalFile'], $info['processedFile']); GeneralUtility::makeInstance(AssetCollector::class)->addMedia( $source, $info ); ...
This means that the public path is used to call the imageLinkWrap function in the method TYPO3\CMS\Frontend\ContentObject\ImageContentObject::cImage:
... } elseif ($conf['imageLinkWrap']) { $originalFile = !empty($info['originalFile']) ? $info['originalFile'] : $info['origFile']; $theValue = $this->cObj->imageLinkWrap($theValue, $originalFile, $conf['imageLinkWrap.']); } ...
Which ultimately leads to a fatal result when determining the file object later in the method TYPO3\CMS\Core\Resource\Driver\LocalDriver::getFileInfoByIdentifier:
... $absoluteFilePath = $this->getAbsolutePath($fileIdentifier); // don't use $this->fileExists() because we need the absolute path to the file anyways, so we can directly // use PHP's filesystem method. if (!file_exists($absoluteFilePath) || !is_file($absoluteFilePath)) { throw new \InvalidArgumentException('File ' . $fileIdentifier . ' does not exist.', 1314516809); } ...
A workaround could be that the identifier is urldecoded after it has been entered in the ResourceFactory or that the public path for the array index 'origFile' is not used at all but the real path is used.
Thanks for fixing.