andersundsehr / aus_driver_amazon_s3

Provides a TYPO3 FAL driver for the Amazon Web Service S3
GNU Lesser General Public License v3.0
21 stars 40 forks source link

[BUGFIX] Make sure mime type is available when no property is specified #114

Closed cweiske closed 9 months ago

cweiske commented 1 year ago

The TYPO3 indexer in sysext/core/Classes/Resource/Index/Indexer.php#gatherFileInformationArray calls "getFileInfoByIdentifier" with an empty "$propertiesToExtract" array, which means it wants to have all information.

S3 driver did not yet return the mime type in that case, causing a crash:

PHP Warning: Undefined array key "mime_type" in typo3/sysext/core/Classes/Resource/Index/Indexer.php line 323

So instead of only fetching the MIME type when it is explicitly requested, we also fetch it when no property has been given.

The error occured when a file was not in sys_file but already existed in storage - e.g. when the storage had been filled outside of TYPO3.

m-knabe-reply commented 1 year ago

Without this fix, the indexer task will set the sys_file.type in the TYPO3 database to 0, so the filetype specific fields in the backend are no longer available. This PR fixes that, so we backported it for our installation, and it works like a charm.