Issue Bug Closed

#102267ProcessedFile: getMimeType and getSize fail when using original file

Christian Weiske 10/27/23, 09:06 updated 07/09/24, 15:19

Description

TYPO3\CMS\Core\Resource\ProcessedFile::getMimeType() and ProcessedFile::getSize() fail under the following conditions:

  • Processed files for file storage #1 are saved in storage #2
  • FileReference::process is called with processing instructions that do not require file modifications

Calling getSize and getMimeType on the resulting ProcessedFile (which uses storage #2) leads to an exception by the underlying storage, because the file does not exist in storage #2 (because no processing took place, and the original file needs to be used as indicated by $processedFile->usesOriginalFile()).

The solution is to override both getSize and getMimeType in ProcessedFile and forward the calls to the original file if necessary.
(This is already done for methods like exists, getIdentifier and getName)

Reviews 2