diff --git a/lib/public/EventDispatcher/JsonSerializer.php b/lib/public/EventDispatcher/JsonSerializer.php index 1eb75ed7527e2..d05367b746d20 100644 --- a/lib/public/EventDispatcher/JsonSerializer.php +++ b/lib/public/EventDispatcher/JsonSerializer.php @@ -9,6 +9,8 @@ namespace OCP\EventDispatcher; +use OC\Files\Node\NonExistingFile; +use OC\Files\Node\NonExistingFolder; use OCP\Files\FileInfo; use OCP\IUser; @@ -24,10 +26,16 @@ final class JsonSerializer { * @since 30.0.0 */ public static function serializeFileInfo(FileInfo $node): array { - return [ - 'id' => $node->getId(), - 'path' => $node->getPath(), - ]; + if ($node instanceof NonExistingFile || $node instanceof NonExistingFolder) { + return [ + 'path' => $node->getPath(), + ]; + } else { + return [ + 'id' => $node->getId(), + 'path' => $node->getPath(), + ]; + } } /**