chg: Rebuild trees when captures are moved.

pull/265/head
Raphaël Vinot 2021-09-23 16:40:39 +02:00
parent 27836b5bdd
commit 1d3bb55343
1 changed files with 6 additions and 1 deletions

View File

@ -68,7 +68,12 @@ def load_pickle_tree(capture_dir: Path) -> CrawledTree:
if pickle_file.exists():
with pickle_file.open('rb') as _p:
try:
return pickle.load(_p)
tree = pickle.load(_p)
if tree.root_hartree.har.path.exists():
return tree
else:
# The capture was moved.
remove_pickle_tree(capture_dir)
except pickle.UnpicklingError:
remove_pickle_tree(capture_dir)
except EOFError: