Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
Handle export errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bensteinberg committed Feb 5, 2024
1 parent a65d5c7 commit d72eb01
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions capstone/scripts/export_cap_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,12 @@ def export_volume(volume: VolumeMetadata, dest_dir: Path) -> None:
el_case_ids = [int(i) for i in el.attrib["data-case-ids"].split(",")]
el_case_paths = [case_paths_by_id[i] for i in el_case_ids if i in case_paths_by_id]
if el_case_paths:
el.attrib["href"] = el_case_paths[0]
el.attrib["data-case-paths"] = ",".join(el_case_paths)
elif "/citations/?q=" in el.attrib["href"]:
try:
el.attrib["href"] = el_case_paths[0]
el.attrib["data-case-paths"] = ",".join(el_case_paths)
except TypeError:
el.attrib["href"] = ""
elif "href" in el.attrib and "/citations/?q=" in el.attrib["href"]:
el.attrib["href"] = "/citations/?q=" + el.attrib["href"].split("/citations/?q=", 1)[1]
else:
el.attrib["href"] = ""
Expand Down

0 comments on commit d72eb01

Please sign in to comment.