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] Create metadata record if necessary #136

Closed cweiske closed 1 day ago

cweiske commented 10 months ago

When uploading a new file in TYPO3 v11.5.33, most of the times the meta data record has not been created yet when the MetaDataUpdateService is called. This patch creates the meta data record when necessary, preventing the following error:

(1/1) #1476107295 TYPO3\CMS\Core\Error\Exception PHP Warning: Undefined array key "uid" in typo3/sysext/core/Classes/Resource/Index/MetaDataRepository.php line 197 Stack trace:

0 typo3/sysext/core/Classes/Resource/Index/MetaDataRepository.php(197): TYPO3\CMS\Core\Error\ErrorHandler->handleError()

1 typo3conf/ext/aus_driver_amazon_s3/Classes/Service/MetaDataUpdateService.php(51): TYPO3\CMS\Core\Resource\Index\MetaDataRepository->update()

2 typo3conf/ext/aus_driver_amazon_s3/Classes/EventListener/AfterFileAddedToIndexEventListener.php(31): AUS\AusDriverAmazonS3\Service\MetaDataUpdateService->updateMetadata()

3 typo3/sysext/core/Classes/EventDispatcher/EventDispatcher.php(51): AUS\AusDriverAmazonS3\EventListener\AfterFileAddedToIndexEventListener->__invoke()

4 typo3/sysext/adminpanel/Classes/Service/EventDispatcher.php(41): TYPO3\CMS\Core\EventDispatcher\EventDispatcher->dispatch()

5 typo3/sysext/core/Classes/Resource/Index/FileIndexRepository.php(340): TYPO3\CMS\Adminpanel\Service\EventDispatcher->dispatch()

6 typo3/sysext/core/Classes/Resource/Index/FileIndexRepository.php(318): TYPO3\CMS\Core\Resource\Index\FileIndexRepository->insertRecord()

7 typo3/sysext/core/Classes/Resource/Index/Indexer.php(84): TYPO3\CMS\Core\Resource\Index\FileIndexRepository->addRaw()

weakbit commented 9 months ago

hi @cweiske thank you for your contribution.

I created an other pullrequest https://github.com/andersundsehr/aus_driver_amazon_s3/pull/142 with minor changes which address this issue.

weakbit commented 1 day ago

@cweiske i merged #142 https://github.com/andersundsehr/aus_driver_amazon_s3/commit/d77bc9899991fd6240acf3b245614aab82a8361e which solves this issue and close this PR. We look forward to do a new release soon.