mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Error message when journal is corrupted, closes #22
This commit is contained in:
parent
8ec7c51d89
commit
4850828e07
1 changed files with 5 additions and 1 deletions
|
@ -50,7 +50,11 @@ class Journal:
|
|||
if not cipher:
|
||||
return ""
|
||||
crypto = AES.new(self.key, AES.MODE_CBC, cipher[:16])
|
||||
try:
|
||||
plain = crypto.decrypt(cipher[16:])
|
||||
except ValueError:
|
||||
print("ERROR: Your journal file seems to be corrupted. You do have a backup, don't you?")
|
||||
sys.exit(-1)
|
||||
if plain[-1] != " ": # Journals are always padded
|
||||
return None
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue