From d3fb3fc04d4c9f084f335bb982df329595596f61 Mon Sep 17 00:00:00 2001 From: Anton Volokha Date: Wed, 28 Feb 2024 11:55:59 +0200 Subject: [PATCH] Small refactoring --- core/encryption_core.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/core/encryption_core.py b/core/encryption_core.py index 937be2b..58146a7 100644 --- a/core/encryption_core.py +++ b/core/encryption_core.py @@ -45,20 +45,20 @@ def decrypt(self): with open(self.input_file, 'rb') as infile: file = [] for line in infile.readlines(): - if delimiter_encoded in line: - metadata = FileMetaData(json_data=line.replace(delimiter_encoded, ''.encode())) + if delimiter_encoded not in line: + file.append(line) + continue - if metadata.is_zip(): - self.zip_file = metadata - with open(metadata.filepath, 'wb') as outfile: - outfile.writelines(file) + metadata = FileMetaData(json_data=line.replace(delimiter_encoded, ''.encode())) - unzip_to_directory(metadata.filepath, self.passphrase) + if metadata.is_zip(): + self.zip_file = metadata + with open(metadata.filepath, 'wb') as outfile: + outfile.writelines(file) - file = [] - continue + unzip_to_directory(metadata.filepath, self.passphrase) - file.append(line) + file = [] except BadPasswordException as e: self.clear() raise e