☔ Harden against corrupt recovery data

Closes #3199
This commit is contained in:
Gina Häußge committed 2019-07-29 16:52:05 +02:00
1 parent 372b3662e9
commit 89255e2ec9
1 file changed
+2
+2
View File
@@ -658,6 +658,8 @@ class FileManager(object):
try:
with open(self._recovery_file) as f:
data = yaml.safe_load(f)
if not isinstance(data, dict) or not all(map(lambda x: x in data, ("origin", "path", "pos", "date"))):
raise ValueError("Invalid recovery data structure")
return data
except:
self._logger.exception("Could not read recovery data from file {}".format(self._recovery_file))