MaxServ / t3ext-fal_s3

S3 driver for FAL
GNU General Public License v2.0
13 stars 10 forks source link

[BUGFIX] Correctly check if a file exists on the S3 bucket #64

Closed djcprinse closed 2 years ago

djcprinse commented 2 years ago

In this bugfix, a method has been added to check if the requested file exists on the S3 storage before trying to fetch a file for local processing or trying to extract metadata of the file.

This adjustment prevents errors in the TYPO3 logs while opening the file list, fetching the file for file processing, extracting metadata on the file and requesting the file from within the frontend.

With this changed behaviour, the ResourceStorage now can correctly mark a file as missing because the php is_file() method returned true if the $fileIdentifier was formatted correctly as a file identifier, and it was not checking if the file would exist on the storage.

This behaviour has only been added to the fileExists method, because S3 does not have folders, so adding the same headObject in the folderExists method would always get to the catch block and return false. The same behaviour as described on https://stackoverflow.com/a/17681486 still applies to S3 and its 'folders'.