Remove intermediate files on en/decryption failure

This commit is contained in:
Arun Prakash Jana 2020-11-22 16:50:36 +05:30
parent 899280efdf
commit 5d5b680405
No known key found for this signature in database
GPG Key ID: A75979F35C080412

3
buku
View File

@ -234,6 +234,7 @@ class BukuCrypt:
print('File encrypted')
sys.exit(0)
except Exception as e:
os.remove(encfile)
LOGERR(e)
sys.exit(1)
@ -329,9 +330,11 @@ class BukuCrypt:
os.remove(encfile)
print('File decrypted')
except struct.error:
os.remove(dbfile)
LOGERR('Tainted file')
sys.exit(1)
except Exception as e:
os.remove(dbfile)
LOGERR(e)
sys.exit(1)