From 4aaf0154285bea6eb2a23c4ef56d5c1b4ccf3fea Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 9 May 2021 18:38:17 +0200 Subject: [PATCH] Also catch tarfile.ReadError as possible archive corruption error --- src/yunohost/backup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/yunohost/backup.py b/src/yunohost/backup.py index cf8394f5b..3978e835d 100644 --- a/src/yunohost/backup.py +++ b/src/yunohost/backup.py @@ -2017,7 +2017,7 @@ class TarBackupMethod(BackupMethod): try: files_in_archive = tar.getnames() - except IOError as e: + except (IOError, EOFError, tarfile.ReadError) as e: raise YunohostError( "backup_archive_corrupted", archive=self._archive_file, error=str(e) ) @@ -2493,7 +2493,7 @@ def backup_info(name, with_details=False, human_readable=False): try: files_in_archive = tar.getnames() - except (IOError, EOFError) as e: + except (IOError, EOFError, tarfile.ReadError) as e: raise YunohostError( "backup_archive_corrupted", archive=archive_file, error=str(e) )