diff --git a/src/yunohost/backup.py b/src/yunohost/backup.py index 5a05a0e2a..98055cd04 100644 --- a/src/yunohost/backup.py +++ b/src/yunohost/backup.py @@ -1928,6 +1928,9 @@ class TarBackupMethod(BackupMethod): logger.debug("cannot open backup archive '%s'", self._archive_file, exc_info=1) raise YunohostError('backup_archive_open_failed') + + # FIXME : Is this really useful to close the archive just to + # reopen it right after this with the same options ...? tar.close() # Mount the tarball @@ -1940,6 +1943,11 @@ class TarBackupMethod(BackupMethod): elif "./info.json" in tar.getnames(): leading_dot = "./" tar.extract('./info.json', path=self.work_dir) + else: + logger.debug("unable to retrieve 'info.json' inside the archive", + exc_info=1) + tar.close() + raise YunohostError('backup_invalid_archive') if "backup.csv" in tar.getnames(): tar.extract('backup.csv', path=self.work_dir) @@ -1984,6 +1992,8 @@ class TarBackupMethod(BackupMethod): ] tar.extractall(members=subdir_and_files, path=self.work_dir) + # FIXME : Don't we want to close the tar archive here or at some point ? + class BorgBackupMethod(BackupMethod):