diff options
author | Christian Breunig <christian@breunig.cc> | 2023-03-10 13:00:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-10 13:00:17 +0100 |
commit | cb8006da2a84396f67c54709169c3d23c19a8c53 (patch) | |
tree | 307fe7411e36ef0ac007ab54fe4b88136e419bd3 | |
parent | fe4da6288649b32779d30d5672e39cae40e72100 (diff) | |
parent | 72ef87421bd472a0eecf22b24d10277180c7a1f3 (diff) | |
download | vyos-1x-cb8006da2a84396f67c54709169c3d23c19a8c53.tar.gz vyos-1x-cb8006da2a84396f67c54709169c3d23c19a8c53.zip |
Merge pull request #1882 from aapostoliuk/T5074-sagitta
util: T5074: Fixed decoding of certificate value to UTF-8 string
-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: |