From 837a9267b9e0a9065881e9ad61458e879cc4d7a8 Mon Sep 17 00:00:00 2001 From: Romain SOMMERARD Date: Thu, 6 Oct 2022 12:00:40 +0200 Subject: [PATCH 1/2] fix: 0b when file is encrypted --- dbbackup/management/commands/dbrestore.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dbbackup/management/commands/dbrestore.py b/dbbackup/management/commands/dbrestore.py index e29999cd..dd7ccdd8 100644 --- a/dbbackup/management/commands/dbrestore.py +++ b/dbbackup/management/commands/dbrestore.py @@ -102,6 +102,7 @@ def _restore_backup(self): ) input_file.close() input_file = unencrypted_file + input_file.seek(0) if self.uncompress: uncompressed_file, input_filename = utils.uncompress_file( input_file, input_filename From 76cd4ec52916fb64490247bf28cfb186f3677e86 Mon Sep 17 00:00:00 2001 From: Romain SOMMERARD Date: Thu, 6 Oct 2022 12:13:10 +0200 Subject: [PATCH 2/2] fix: 0B when not encrypted and not compressed --- dbbackup/management/commands/dbrestore.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dbbackup/management/commands/dbrestore.py b/dbbackup/management/commands/dbrestore.py index dd7ccdd8..a820c957 100644 --- a/dbbackup/management/commands/dbrestore.py +++ b/dbbackup/management/commands/dbrestore.py @@ -109,6 +109,9 @@ def _restore_backup(self): ) input_file.close() input_file = uncompressed_file + if not self.decrypt and not self.uncompress: + tmp_file = utils.create_spooled_temporary_file(fileobj=input_file) + input_file = tmp_file self.logger.info("Restore tempfile created: %s", utils.handle_size(input_file)) if self.interactive: