Skip to content

Commit ac366e1

Browse files
icewind1991AndyScherzinger
authored andcommitted
fix: don't try to get fileid for non exising nodes when serializing events file
Signed-off-by: Robin Appelman <[email protected]>
1 parent 2ae6393 commit ac366e1

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

lib/public/EventDispatcher/JsonSerializer.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
namespace OCP\EventDispatcher;
1111

12+
use OC\Files\Node\NonExistingFile;
13+
use OC\Files\Node\NonExistingFolder;
1214
use OCP\Files\FileInfo;
1315
use OCP\IUser;
1416

@@ -24,10 +26,16 @@ final class JsonSerializer {
2426
* @since 30.0.0
2527
*/
2628
public static function serializeFileInfo(FileInfo $node): array {
27-
return [
28-
'id' => $node->getId(),
29-
'path' => $node->getPath(),
30-
];
29+
if ($node instanceof NonExistingFile || $node instanceof NonExistingFolder) {
30+
return [
31+
'path' => $node->getPath(),
32+
];
33+
} else {
34+
return [
35+
'id' => $node->getId(),
36+
'path' => $node->getPath(),
37+
];
38+
}
3139
}
3240

3341
/**

0 commit comments

Comments
 (0)