From 1c9eab6b2bab3fce9fb3a0bd9efc47100bbdf87a Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 16 May 2019 15:48:09 +0200 Subject: [PATCH] Prevent crashes when backup fails to be restored Also add a bit of logging so that we know what / how it went wrong --- cura/Backups/Backup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cura/Backups/Backup.py b/cura/Backups/Backup.py index 399a4ea7b0..9ccdcaf64d 100644 --- a/cura/Backups/Backup.py +++ b/cura/Backups/Backup.py @@ -148,5 +148,9 @@ class Backup: Logger.log("d", "Removing current data in location: %s", target_path) Resources.factoryReset() Logger.log("d", "Extracting backup to location: %s", target_path) - archive.extractall(target_path) + try: + archive.extractall(target_path) + except PermissionError: + Logger.logException("e", "Unable to extract the backup due to permission errors") + return False return True