mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 14:44:29 -04:00
ignore json parsing errors when loading link jsons
This commit is contained in:
parent
e91cdfbc88
commit
03470699d3
1 changed files with 5 additions and 2 deletions
|
@ -96,8 +96,11 @@ def parse_json_link_details(out_dir: str) -> Optional[Link]:
|
||||||
existing_index = os.path.join(out_dir, JSON_INDEX_FILENAME)
|
existing_index = os.path.join(out_dir, JSON_INDEX_FILENAME)
|
||||||
if os.path.exists(existing_index):
|
if os.path.exists(existing_index):
|
||||||
with open(existing_index, 'r', encoding='utf-8') as f:
|
with open(existing_index, 'r', encoding='utf-8') as f:
|
||||||
|
try:
|
||||||
link_json = json.load(f)
|
link_json = json.load(f)
|
||||||
return Link.from_json(link_json)
|
return Link.from_json(link_json)
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
pass
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@enforce_types
|
@enforce_types
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue