Skip to content

Commit

Permalink
more debug on this particular json schema error
Browse files Browse the repository at this point in the history
  • Loading branch information
donpdonp committed Mar 1, 2022
1 parent 06aab5f commit befda75
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,14 @@ fn netback(command: *thread.Command) void {
cache_update(toot, alloc);

for (images.items) |image| {
const imgUrl = image.Object.get("preview_url").?.String;
warn("toot #{s} has img {s}\n", .{ toot.id(), imgUrl });
mediaget(toot, imgUrl, alloc);
const img_url_raw = image.Object.get("preview_url").?;
if (img_url_raw == .String) {
const img_url = img_url_raw.String;
warn("toot #{s} has img {s}\n", .{ toot.id(), img_url });
mediaget(toot, img_url, alloc);
} else {
warn("WARNING: image json 'preview_url' is not String: {}", .{img_url_raw});
}
}
}
}
Expand Down

0 comments on commit befda75

Please sign in to comment.