fix: Properly handle json dumps

pull/78/head
Raphaël Vinot 2020-07-06 14:16:17 +02:00
parent 1d77a2001e
commit 605dc00989
1 changed files with 3 additions and 1 deletions

View File

@ -261,7 +261,9 @@ class Lookyloo():
with (Path(capture_dir) / 'error.txt').open() as _error:
content = _error.read()
try:
error_to_cache = json.loads(content)['details']
error_to_cache = json.loads(content)
if isinstance(error_to_cache, dict) and error_to_cache.get('details'):
error_to_cache = error_to_cache.get('details')
except json.decoder.JSONDecodeError:
# old format
error_to_cache = content