From 39f79aacd271d3d66cdf28f29ed9219089de4ae8 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Sat, 18 May 2019 09:11:58 -0500 Subject: [PATCH] Better check for failed GPG decryption. --- pass2csv.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pass2csv.py b/pass2csv.py index d276ae4..d1a6b84 100755 --- a/pass2csv.py +++ b/pass2csv.py @@ -88,7 +88,6 @@ class CSVExporter(): return (user, url, '\n'.join(notes).strip()) def parse(self, basepath, path, data): - name = os.path.splitext(os.path.basename(path))[0] group = os.path.dirname(os.path.os.path.relpath(path, basepath)) split_data = data.split('\n', maxsplit=1) @@ -116,7 +115,7 @@ def main(kpx_format, gpgbinary, use_agent, pass_path): if os.path.splitext(file_path)[1] == '.gpg': with open(file_path, 'rb') as f: data = str(gpg.decrypt_file(f)) - if str == "": + if len(data) == 0: raise ValueError("The password file is empty") csv_data.append(exporter.parse(pass_path, file_path, data))