From 65a053621da2ef4c8ede5556a5e090084d9ea03d Mon Sep 17 00:00:00 2001 From: rickymk <ricky.mk@pitsolutions.com> Date: Tue, 29 Aug 2017 16:48:10 +0530 Subject: [PATCH] [BUGFIX] Catch Exception while extracting metadata Catch InsufficientFileAccessPermissionsException while extracting metadata. Reason for this exception could be that the file extension is not allowed by the ['BE']['fileDenyPattern'] setting. This patch makes sure that the indexer doesn't break and is able to extract the other files from storage. Resolves: #82060 Release: master, 8.7, 7.6 Change-Id: I37950aa70f4f59b388c6b9203e1922708ad07b71 Reviewed-on: https://review.typo3.org/53834 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Ricky Mathew <ricky.mk@pitsolutions.com> Tested-by: Ricky Mathew <ricky.mk@pitsolutions.com> Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com> Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Reviewed-by: Georg Ringer <georg.ringer@gmail.com> Tested-by: Georg Ringer <georg.ringer@gmail.com> --- .../sysext/core/Classes/Resource/Index/Indexer.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/typo3/sysext/core/Classes/Resource/Index/Indexer.php b/typo3/sysext/core/Classes/Resource/Index/Indexer.php index 2813fdd65616..25d69d47d1be 100644 --- a/typo3/sysext/core/Classes/Resource/Index/Indexer.php +++ b/typo3/sysext/core/Classes/Resource/Index/Indexer.php @@ -14,6 +14,8 @@ namespace TYPO3\CMS\Core\Resource\Index; * The TYPO3 project - inspiring people to share! */ +use TYPO3\CMS\Core\Resource\Exception\IllegalFileExtensionException; +use TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException; use TYPO3\CMS\Core\Resource\File; use TYPO3\CMS\Core\Resource\ResourceFactory; use TYPO3\CMS\Core\Resource\ResourceStorage; @@ -108,10 +110,15 @@ class Indexer $fileObject = $this->getResourceFactory()->getFileObject($indexRecord['uid'], $indexRecord); // Check for existence of file before extraction if ($fileObject->exists()) { - $this->extractMetaData($fileObject); - - // Mark file as missing and continue with next record + try { + $this->extractMetaData($fileObject); + } catch (InsufficientFileAccessPermissionsException $e) { + // We skip files that are not accessible + } catch (IllegalFileExtensionException $e) { + // We skip files that have an extension that we don't allow + } } else { + // Mark file as missing and continue with next record $this->getFileIndexRepository()->markFileAsMissing($indexRecord['uid']); } } -- GitLab