Merge pull request #1895 from ThomasWaldmann/fix-1894

fix traceback in Error handler if id is None, fixes #1894
This commit is contained in:
TW 2016-11-29 19:26:17 +01:00 committed by GitHub
commit b25de0ab38
1 changed files with 2 additions and 1 deletions

View File

@ -105,7 +105,8 @@ class PlaintextKey(KeyBase):
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))