From 820c7c5a4d93d78fb1a4db7eaaf36b616404c8a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Tue, 1 Dec 2020 17:00:44 +0100 Subject: [PATCH] fix: remove broken pickles if needed --- lookyloo/helpers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lookyloo/helpers.py b/lookyloo/helpers.py index e1ea753b..06753e41 100644 --- a/lookyloo/helpers.py +++ b/lookyloo/helpers.py @@ -304,7 +304,10 @@ def load_pickle_tree(capture_dir: Path) -> Optional[CrawledTree]: pickle_file = capture_dir / 'tree.pickle' if pickle_file.exists(): with pickle_file.open('rb') as _p: - return pickle.load(_p) + try: + return pickle.load(_p) + except pickle.UnpicklingError: + remove_pickle_tree(capture_dir) return None