Bug #59419
closedMethod "getImgResource" sets variable "origFile" to invalid value
0%
Description
When the method "getImgResource" (ContentObjectRendere.php) gets called it sets the variable "origFile" according to the following statement:
'origFile' => $fileObject->getPublicUrl(),
In the "ImageResourceContentObject" (IMG_RESOURCE) the return value of "getImgResource" is used as folowing:
$GLOBALS['TSFE']->lastImgResourceInfo = $this->cObj->getImgResource($conf['file'], $conf['file.']);
As the method "getPublicUrl" is used for retrieving the "origFile" variable this value will be URL encoded. Now if there is a special character like space or umlauts in the filename the value "origFile" will not contain the original filename but rather a value which can get used to link to the file in URLs. This is different than in previous versions of TYPO3:
$GLOBALS['TSFE']->tmpl->fileCache[$hash]['origFile'] = $theImage;
I suggest to change the call to "getPublicUrl()" to "getForLocalProcessing()". I assume the name "origFile" rather tends to get filled with an filename than an URL.
Some extensions like "chgallery" refuse to have a properly working lightbox if this doesn't get changed. The problem there is that "TSFE:lastImgResourceInfo|origFile" gets passed again to IMG_RESOURCE and IMG_RESOURCE will refuse to work on a filename with "%20" or other url-encoded filenames.
I guess this issue will affect every IMAGE and IMG_RESOURCE TypoScript object where inside the object the originial file is used for generating alternate variants of the image. The only sense for having an URL encoded value in "origFile" would be to generate download links - but I guess doing a rawurlencode() of the filename should be done by the presentation layer.
I will create a patch and send it to gerrit for review.
Updated by Gerrit Code Review over 10 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30631
Updated by Gerrit Code Review over 10 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30631
Updated by Gerrit Code Review over 10 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30631
Updated by Gerrit Code Review over 10 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30631
Updated by Steffen Ritter over 10 years ago
- Target version deleted (
next-patchlevel)
Updated by Steffen Müller almost 10 years ago
- Status changed from Under Review to Closed
Discussion in gerrit resulted in closing this issue without fix. This can get achieved using "directImageLink".
Docs have been updated to make this more clear: https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-Typoscript/pull/2/commits