From d9398c08431134331c77148ce83256eb52700587 Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Mon, 7 Apr 2025 12:16:25 -0700 Subject: [PATCH] fix path discrepency between event types --- src/root.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/root.zig b/src/root.zig index 816a546..8d1c26c 100644 --- a/src/root.zig +++ b/src/root.zig @@ -59,6 +59,8 @@ pub const SyncthingEvent = struct { pub fn fromJson(allocator: std.mem.Allocator, value: std.json.Value) !SyncthingEvent { const data = value.object.get("data").?.object; + // event values differ on this point... + const path = data.get("item") orelse data.get("path"); return SyncthingEvent{ .id = value.object.get("id").?.integer, .time = try allocator.dupe(u8, value.object.get("time").?.string), @@ -66,7 +68,7 @@ pub const SyncthingEvent = struct { .data_type = try allocator.dupe(u8, data.get("type").?.string), .folder = try allocator.dupe(u8, data.get("folder").?.string), .action = try allocator.dupe(u8, data.get("action").?.string), - .path = try allocator.dupe(u8, data.get("item").?.string), + .path = try allocator.dupe(u8, path.?.string), }; }