Skip indices with empty ID

This commit is contained in:
orbifx 2022-11-17 20:15:26 +00:00
parent 1fa25c766b
commit ccec104c5e
1 changed files with 3 additions and 1 deletions

View File

@ -93,6 +93,8 @@ let pull_index url authors_opt topics_opt =
| Ok body ->
match Logarion.Header_pack.of_string (Buffer.contents body) with
| Error s -> Printf.printf "Error with %s: %s\n" url s; false
| Ok pk when pk.info.id = "" ->
Printf.printf "Empty ID index.pck, skipping %s\n" url; false
| Ok pk ->
let dir = Filename.concat Logarion.Peers.text_dir pk.info.id in
Logarion.File_store.with_dir dir;
@ -108,7 +110,7 @@ let pull_index url authors_opt topics_opt =
let name = match pk.info.title with "" -> url | title -> title in
let print = printers (string_of_int @@ Logarion.Header_pack.numof_texts pk) name dir in
try Logarion.Header_pack.iteri (per_text url dir filter print) pk; print_newline (); true
with Invalid_argument msg -> Printf.eprintf "\nFailed to parse %s: %s\n%!" url msg; false
with Invalid_argument msg -> Printf.printf "\nFailed to parse %s: %s\n%!" url msg; false
let pull_list auths topics =
Curl.global_init Curl.CURLINIT_GLOBALALL;