From 1d3bb5534340ac71970f228bf8d40d20182d0e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Thu, 23 Sep 2021 16:40:39 +0200 Subject: [PATCH] chg: Rebuild trees when captures are moved. --- lookyloo/capturecache.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lookyloo/capturecache.py b/lookyloo/capturecache.py index 759716dd..3faec26c 100644 --- a/lookyloo/capturecache.py +++ b/lookyloo/capturecache.py @@ -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: