☔ Further hardening against corrupt recovery data

This commit is contained in:
Gina Häußge committed 2019-07-29 16:55:32 +02:00
1 parent 89255e2ec9
commit 4c602cba2e
1 file changed
+11 -7
+11 -7
View File
@@ -483,14 +483,18 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
path_on_disk = self._fileManager.path_on_disk(origin, path)
path_in_storage = self._fileManager.path_in_storage(origin, path_on_disk)
recovery_data = self._fileManager.get_recovery_data()
if recovery_data:
# clean up recovery data if we just selected a different file than is logged in that
actual_origin = recovery_data.get("origin", None)
actual_path = recovery_data.get("path", None)
try:
recovery_data = self._fileManager.get_recovery_data()
if recovery_data:
# clean up recovery data if we just selected a different file
actual_origin = recovery_data.get("origin", None)
actual_path = recovery_data.get("path", None)
if actual_origin is None or actual_path is None or actual_origin != origin or actual_path != path_in_storage:
self._fileManager.delete_recovery_data()
if actual_origin is None or actual_path is None or actual_origin != origin or actual_path != path_in_storage:
self._fileManager.delete_recovery_data()
except Exception:
# anything goes wrong with the recovery data, we ignore it
self._logger.exception("Something was wrong with processing the recovery data")
self._printAfterSelect = printAfterSelect
self._posAfterSelect = pos