From 5563d5c8cb858eb8b0c6ffaf4a00b2505ce9a69a Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 13 May 2026 08:32:24 +0200 Subject: [PATCH] fix(listeners): handle NonExistingFile gracefully When creating a node the `BeforeNodeWritten` event fires with a `NonExistingFile` which will throw a `NotFoundException` when attempting to read the file id. Handle this gracefully by returning early. Signed-off-by: Max --- lib/Listeners/NodeWrittenResetDocumentListener.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Listeners/NodeWrittenResetDocumentListener.php b/lib/Listeners/NodeWrittenResetDocumentListener.php index 999dad8cb7f..3df2a489fdf 100644 --- a/lib/Listeners/NodeWrittenResetDocumentListener.php +++ b/lib/Listeners/NodeWrittenResetDocumentListener.php @@ -39,6 +39,12 @@ public function handle(Event $event): void { if (!$node instanceof File) { return; } + try { + $node->getId(); + } catch (NotFoundException $e) { + // Handle non existing node (during creation). + return; + } if (!$this->documentService->getDocument($node->getId())) { return; }