fix: Handle malformed previous_defed.json
parent
3b80a4043e
commit
f5850e8cc7
|
@ -82,7 +82,8 @@ defed = (set(blocklist) | set(trusted_censures["domains"]) | set(filtered_censur
|
||||||
try:
|
try:
|
||||||
with open("previous_defed.json", 'r') as file:
|
with open("previous_defed.json", 'r') as file:
|
||||||
prev_defed = set(json.loads(file.read()))
|
prev_defed = set(json.loads(file.read()))
|
||||||
except FileNotFoundError:
|
except (FileNotFoundError,json.decoder.JSONDecodeError):
|
||||||
|
print("WARNING: Previous defed file doesn't exist. Will probably receive a warning about blocklist.")
|
||||||
prev_defed = set()
|
prev_defed = set()
|
||||||
if len(defed - prev_defed) > 0:
|
if len(defed - prev_defed) > 0:
|
||||||
print(f"New blocks to add {defed - prev_defed}")
|
print(f"New blocks to add {defed - prev_defed}")
|
||||||
|
|
Loading…
Reference in New Issue