diff --git a/apps/admin_audit/lib/Actions/Files.php b/apps/admin_audit/lib/Actions/Files.php index ee40a4e14767f..80eabb3b1b753 100644 --- a/apps/admin_audit/lib/Actions/Files.php +++ b/apps/admin_audit/lib/Actions/Files.php @@ -7,6 +7,7 @@ */ namespace OCA\AdminAudit\Actions; +use OC\Files\Node\NonExistingFile; use OCP\Files\Events\Node\BeforeNodeReadEvent; use OCP\Files\Events\Node\BeforeNodeRenamedEvent; use OCP\Files\Events\Node\BeforeNodeWrittenEvent; @@ -35,9 +36,10 @@ class Files extends Action { */ public function read(BeforeNodeReadEvent $event): void { try { + $node = $event->getNode(); $params = [ - 'id' => $event->getNode()->getId(), - 'path' => mb_substr($event->getNode()->getInternalPath(), 5), + 'id' => $node instanceof NonExistingFile ? null : $node->getId(), + 'path' => mb_substr($node->getInternalPath(), 5), ]; } catch (InvalidPathException|NotFoundException $e) { \OCP\Server::get(LoggerInterface::class)->error(