From 58009f6773c5658a3b0dc7b8fd8c956f7ed158c8 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Mon, 30 May 2022 13:38:05 +0200 Subject: [PATCH] Key: fix once, remove decode=... --- src/borg/item.pyx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/borg/item.pyx b/src/borg/item.pyx index 5e6e401f5..169aec048 100644 --- a/src/borg/item.pyx +++ b/src/borg/item.pyx @@ -465,10 +465,10 @@ class Key(PropDict): __slots__ = ("_dict", ) # avoid setting attributes not supported by properties version = PropDict._make_property('version', int) - repository_id = PropDict._make_property('repository_id', bytes, decode=want_bytes) - enc_key = PropDict._make_property('enc_key', bytes, decode=want_bytes) - enc_hmac_key = PropDict._make_property('enc_hmac_key', bytes, decode=want_bytes) - id_key = PropDict._make_property('id_key', bytes, decode=want_bytes) + repository_id = PropDict._make_property('repository_id', bytes) + enc_key = PropDict._make_property('enc_key', bytes) + enc_hmac_key = PropDict._make_property('enc_hmac_key', bytes) + id_key = PropDict._make_property('id_key', bytes) chunk_seed = PropDict._make_property('chunk_seed', int) tam_required = PropDict._make_property('tam_required', bool) @@ -478,6 +478,8 @@ class Key(PropDict): k = fix_key(d, k) if k == 'version': assert isinstance(v, int) + if k in ('repository_id', 'enc_key', 'enc_hmac_key', 'id_key'): + v = fix_bytes_value(d, k) self._dict[k] = v