diff --git a/lib/Listener/CacheEntryRemovedListener.php b/lib/Listener/CacheEntryRemovedListener.php index 20d088dbb..2455cac7d 100644 --- a/lib/Listener/CacheEntryRemovedListener.php +++ b/lib/Listener/CacheEntryRemovedListener.php @@ -19,10 +19,16 @@ public function handle(Event $event): void { return; } - // Remove node from all albums containing it. - $albums = $this->albumMapper->getForFile($event->getFileId()); - foreach ($albums as $album) { - $this->albumMapper->removeFile($album->getId(), $event->getFileId()); + try { + // Remove node from all albums containing it. + $albums = $this->albumMapper->getForFile($event->getFileId()); + + foreach ($albums as $album) { + $this->albumMapper->removeFile($album->getId(), $event->getFileId()); + } + } catch(\Throwable $ex) { + // If an error occur, return silently as we don't want to block the rest of the deletion process. + // It happened already during migrations when the albums table is not yet created, but a folder is deleted by the theming app. } } }