Also catch tarfile.ReadError as possible archive corruption error

This commit is contained in:
Alexandre Aubin 2021-05-09 18:38:17 +02:00 committed by GitHub
parent 2ea4c2bae9
commit 4aaf015428
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2017,7 +2017,7 @@ class TarBackupMethod(BackupMethod):
try: try:
files_in_archive = tar.getnames() files_in_archive = tar.getnames()
except IOError as e: except (IOError, EOFError, tarfile.ReadError) as e:
raise YunohostError( raise YunohostError(
"backup_archive_corrupted", archive=self._archive_file, error=str(e) "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: try:
files_in_archive = tar.getnames() files_in_archive = tar.getnames()
except (IOError, EOFError) as e: except (IOError, EOFError, tarfile.ReadError) as e:
raise YunohostError( raise YunohostError(
"backup_archive_corrupted", archive=archive_file, error=str(e) "backup_archive_corrupted", archive=archive_file, error=str(e)
) )