From a9399ac85cbf2c361e6d1350d0f30c15277a2d9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Tue, 19 Mar 2024 10:49:45 +0100 Subject: [PATCH] fix(metdata): Correctly handle FilesMetadataNotFoundException on blurhash generation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- .../Blurhash/Listener/GenerateBlurhashMetadata.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php b/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php index b57dfa317e484..ef74a5c81bd11 100644 --- a/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php +++ b/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php @@ -37,6 +37,7 @@ use OCP\FilesMetadata\AMetadataEvent; use OCP\FilesMetadata\Event\MetadataBackgroundEvent; use OCP\FilesMetadata\Event\MetadataLiveEvent; +use OCP\FilesMetadata\Exceptions\FilesMetadataNotFoundException; use OCP\IPreview; use OCP\Lock\LockedException; @@ -74,8 +75,12 @@ public function handle(Event $event): void { $currentEtag = $file->getEtag(); $metadata = $event->getMetadata(); - if ($metadata->getEtag('blurhash') === $currentEtag) { - return; + + try { + if ($metadata->getEtag('blurhash') === $currentEtag) { + return; + } + } catch (FilesMetadataNotFoundException) { } // too heavy to run on the live thread, request a rerun as a background job