Issue Bug Under Review Quiet Regression

#110318ProcessedFile::getForLocalProcessing() asks the processing storage for a file that points to the original

Riny van Tiggelen 07/29/26, 11:09 updated 10/01/26, 07:47

Description

Problem

When processing produces no new file (for example if the original is already smaller than the requested size) the processed file is only a pointer to the original: usesOriginalFile() is true and getIdentifier() returns the identifier of the original file, while getStorage() returns the processing storage.

Every accessor compensates for that mismatch (exists(), getName(), getMimeType(), getSize(), getPublicUrl(), toArray()).
@getForLocalProcessing()@ does not, because ProcessedFile never overrides it:

// AbstractFile::getForLocalProcessing()
return $this->getStorage()->getFileForLocalProcessing($this, $writable);

The identifier of the original file is therefore handed to the driver of the processing storage.
This is not a problem when:
- both are the same storage
- a local driver is used (this just returns a path to a non-existing file, also not great but not breaking)

But when you have the processingfolder of one storage pointing to another one (2:_processed_/) and using a remote driver (in my case S3) this means that the image does not exist and it throws an error and the image rendering fails.

Steps to reproduce

  1. Add a second Local storage, base path fileadmin/processed_storage/.
  2. Set Processing folder of storage 1 to 2:/.
  3. Upload a (for example) 200×200 image and render it without scaling, for example <f:image image="{file}" maxWidth="1000" />.
$processed = $file->process(ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, ['maxWidth' => 1000]);

$processed->usesOriginalFile();      // true
$processed->getPublicUrl();          // fileadmin/user_upload/image.jpg            <- correct
$processed->getForLocalProcessing(); // .../fileadmin/processed_storage/...        <- wrong storage

Expected: getForLocalProcessing() returns a local copy of the original file, consistent with getPublicUrl().

Regression

ProcessedFile never had an override of the method but it became a problem with the change in #106518, where ImageResource::createFromProcessedFile() was switched from getPublicUrl() to getForLocalProcessing()

Affected: 13.4.10 and newer

Related

  • #106518 – introduced the call
  • #89004 – describes how the empty-identifier state arises
  • #106985 – same call chain

Reviews 1

History 35