Skip to content
Permalink
Browse files

Fix encoding error on adding binary data to a cfg

UnicodeDecodeError: 'ascii' codec can't decode byte 0xa0 in
position 40: ordinal not in range(128)

Raised upon om test/cfg/cf1 add --key ls --from /bin/ls
  • Loading branch information...
cvaroqui committed Jul 16, 2019
1 parent 4a2fbc3 commit 3d1bba7180ba54b8299df8e7737b208efa098328
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/cfg.py
@@ -31,7 +31,7 @@ def _add_key(self, key, data):
if not data:
raise ex.excError("configuration value can not be empty")
if not is_string(data) or "\n" in data:
data = "base64:"+base64.urlsafe_b64encode(data.encode()).decode()
data = "base64:"+base64.urlsafe_b64encode(data)
else:
data = "literal:"+data
self.set_multi(["data.%s=%s" % (key, data)])

0 comments on commit 3d1bba7

Please sign in to comment.
You can’t perform that action at this time.