diff options
author | aapostoliuk <a.apostoliuk@vyos.io> | 2023-03-10 10:38:18 +0200 |
---|---|---|
committer | aapostoliuk <a.apostoliuk@vyos.io> | 2023-03-10 10:38:18 +0200 |
commit | 72ef87421bd472a0eecf22b24d10277180c7a1f3 (patch) | |
tree | 307fe7411e36ef0ac007ab54fe4b88136e419bd3 /python/vyos | |
parent | fe4da6288649b32779d30d5672e39cae40e72100 (diff) | |
download | vyos-1x-72ef87421bd472a0eecf22b24d10277180c7a1f3.tar.gz vyos-1x-72ef87421bd472a0eecf22b24d10277180c7a1f3.zip |
util: T5074: Fixed decoding of certificate value to UTF-8 string
Fixed decoding of certificate value returned by vici
to UTF-8 string.
Diffstat (limited to 'python/vyos')
-rw-r--r-- | python/vyos/util.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/python/vyos/util.py b/python/vyos/util.py index 66ded464d..0593184cc 100644 --- a/python/vyos/util.py +++ b/python/vyos/util.py @@ -874,12 +874,16 @@ def convert_data(data): Returns: str | list | dict: converted data """ + from base64 import b64encode from collections import OrderedDict if isinstance(data, str): return data if isinstance(data, bytes): - return data.decode() + try: + return data.decode() + except UnicodeDecodeError: + return b64encode(data).decode() if isinstance(data, list): list_tmp = [] for item in data: |