╭ changed ───────────────╮ │src/event/Attachment.zig│ ╰────────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │84 break :blk record; │ │85 }; │ │86 │ │87 - // references use the same lower-case hex form as event ids in json │ │88 - var id_bytes: [evt.event_id_size]u8 = undefined; │ │89 - _ = try std.fmt.hexToBytes(&id_bytes, &record_to_write.event.parent_id); │ │90 - if (!std.mem.eql(u8, &record_to_write.event.parent_id, &std.fmt.bytesToHex(id_bytes, .lower))) return error.InvalidEventId;│ │87 + const id_bytes = try evt.parseEventId(&record_to_write.event.parent_id); │ │88 if (!try parentExists(DB, hash_kind, haxy_moment, &id_bytes)) return error.ParentNotFound; │ │89 if (!nameValid(record_to_write.name)) return error.InvalidAttachment; │ │90 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │132 if (!nameValid(blob.name)) return error.InvalidFields; │ │133 if (blob.size == 0 or blob.size > max_size) return error.InvalidFields; │ │134 │ │138 - var parent_id_bytes: [evt.event_id_size]u8 = undefined; │ │139 - _ = std.fmt.hexToBytes(&parent_id_bytes, parent_id) catch return error.InvalidFields; │ │140 - if (!std.mem.eql(u8, parent_id, &std.fmt.bytesToHex(parent_id_bytes, .lower))) return error.InvalidFields;│ │135 + const parent_id_bytes = evt.parseEventId(parent_id) catch return error.InvalidFields; │ │136 │ │137 { │ │138 const DB = evt.EventDB(repo_opts.hash); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────╮ │154 .id = event_id, │ │155 .timestamp = @intCast(std.Io.Timestamp.now(io, .real).toSeconds()),│ │156 .author = author, │ │162 - .blob = blob, │ │157 + .tree_entries = &.{.{ .blob = blob }}, │ │158 .event = .{ .attach = .{ .parent_id = parent_id.* } }, │ │159 }}); │ │160 return event_id; │ ╰────────────────────────────────────────────────────────────────────────────────╯