From 046dea8643758816957d77d0893e0449d631f029 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Tue, 19 Nov 2019 20:43:32 +0100 Subject: [PATCH] check: do not stumble over invalid item key, fixes #4845 The code used for error reporting crashes due to an invalid utf-8 sequence. Use errors='replace' to never crash there. Errors are expected in input data when borg check is run. --- src/borg/archive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/borg/archive.py b/src/borg/archive.py index dbbead428..d997c9dd4 100644 --- a/src/borg/archive.py +++ b/src/borg/archive.py @@ -1726,7 +1726,7 @@ def report(msg, chunk_id, chunk_no): logger.error(msg) def list_keys_safe(keys): - return ', '.join((k.decode() if isinstance(k, bytes) else str(k) for k in keys)) + return ', '.join((k.decode(errors='replace') if isinstance(k, bytes) else str(k) for k in keys)) def valid_item(obj): if not isinstance(obj, StableDict):