Bug Report
Current behavior
FileUtility::process() accepts a FileInterface, but unconditionally treats it as a FileReference:
$fileReferenceUid = $fileReference->getUid();
$uidLocal = $fileReference->getProperty('uid_local');
When the GalleryProcessor loads images through a "Folder from Storage" FileCollection, the file objects are plain \TYPO3\CMS\Core\Resource\File instances, not FileReferences. In that case the file's own uid ends up in fileReferenceUid while uidLocal stays null.
GalleryProcessor::prepareGalleryData() then re-resolves every image with treatIdAsReference: true:
$src = $this->processorConfigurationObject->legacyReturn ? $fileObj['properties']['fileReferenceUid'] : $fileObj['fileReferenceUid'];
$image = $this->getImageService()->getImage((string)$src, null, true);
So a plain file uid is interpreted as a sys_file_reference uid, which resolves to the wrong image (or fails) for folder-based collections.
Expected behavior
Plain File objects should be output with uidLocal set and fileReferenceUid: null, and the GalleryProcessor should only resolve via reference when a reference uid actually exists.
Steps to reproduce
- Create a file collection of type "Folder from Storage" containing images.
- Render it via a content element that uses the
GalleryProcessor (e.g. textmedia).
- Observe the wrong or broken image output in the JSON response.
Fix
We fixed this on our fork by only reading uid_local when the object is instanceof FileReference, and by falling back to uidLocal (with treatIdAsReference: false) in GalleryProcessor when fileReferenceUid is null — unit test baselines updated accordingly:
master...Digi92:feature/galleryprocessor-file-handling
I hope this can be fixed asap, as this breaks our whole image setup for carousal galleries in TYPO3.
CC @Digi92
Happy to open a PR from that branch.
Bug Report
Current behavior
FileUtility::process()accepts aFileInterface, but unconditionally treats it as aFileReference:When the
GalleryProcessorloads images through a "Folder from Storage" FileCollection, the file objects are plain\TYPO3\CMS\Core\Resource\Fileinstances, notFileReferences. In that case the file's own uid ends up infileReferenceUidwhileuidLocalstaysnull.GalleryProcessor::prepareGalleryData()then re-resolves every image withtreatIdAsReference: true:So a plain file uid is interpreted as a
sys_file_referenceuid, which resolves to the wrong image (or fails) for folder-based collections.Expected behavior
Plain
Fileobjects should be output withuidLocalset andfileReferenceUid: null, and theGalleryProcessorshould only resolve via reference when a reference uid actually exists.Steps to reproduce
GalleryProcessor(e.g.textmedia).Fix
We fixed this on our fork by only reading
uid_localwhen the object isinstanceof FileReference, and by falling back touidLocal(withtreatIdAsReference: false) inGalleryProcessorwhenfileReferenceUidisnull— unit test baselines updated accordingly:master...Digi92:feature/galleryprocessor-file-handling
I hope this can be fixed asap, as this breaks our whole image setup for carousal galleries in TYPO3.
CC @Digi92
Happy to open a PR from that branch.