diff --git a/features/steps/core.py b/features/steps/core.py index 7997f8e7..fadaefc2 100644 --- a/features/steps/core.py +++ b/features/steps/core.py @@ -167,7 +167,7 @@ def check_output_inline(context, text): out = context.stdout_capture.getvalue() if isinstance(out, bytes): out = out.decode('utf-8') - assert text in out + assert text in out, text @then('the output should not contain "{text}"') diff --git a/jrnl/EncryptedJournal.py b/jrnl/EncryptedJournal.py index 17cb880d..ae37769d 100644 --- a/jrnl/EncryptedJournal.py +++ b/jrnl/EncryptedJournal.py @@ -80,13 +80,13 @@ class LegacyEncryptedJournal(Journal.LegacyJournal): try: plain_padded = decryptor.update(cipher) + decryptor.finalize() self.config['password'] = password - if plain_padded[-1] == " ": + if plain_padded[-1] in (" ", 32): # Ancient versions of jrnl. Do not judge me. - plain = plain_padded.rstrip(" ") + return plain_padded.decode('utf-8').rstrip(" ") else: unpadder = padding.PKCS7(algorithms.AES.block_size).unpadder() plain = unpadder.update(plain_padded) + unpadder.finalize() - return plain.decode('utf-8') + return plain.decode('utf-8') except ValueError: return None if password: