From cd50e286f712242fbbcc5c2143ab26c9ecf0d7d4 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Tue, 29 Nov 2016 01:34:11 +0100 Subject: [PATCH] fix traceback in Error handler if id is None, fixes #1894 --- borg/key.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/borg/key.py b/borg/key.py index 7b65d9093..944e17d72 100644 --- a/borg/key.py +++ b/borg/key.py @@ -105,7 +105,8 @@ def encrypt(self, data): def decrypt(self, id, data): if data[0] != self.TYPE: - raise IntegrityError('Chunk %s: Invalid encryption envelope' % bin_to_hex(id)) + id_str = bin_to_hex(id) if id is not None else '(unknown)' + raise IntegrityError('Chunk %s: Invalid encryption envelope' % id_str) data = self.compressor.decompress(memoryview(data)[1:]) if id and sha256(data).digest() != id: raise IntegrityError('Chunk %s: id verification failed' % bin_to_hex(id))