summaryrefslogtreecommitdiff
path: root/python/vyos
diff options
context:
space:
mode:
authoraapostoliuk <a.apostoliuk@vyos.io>2023-03-10 10:38:18 +0200
committeraapostoliuk <a.apostoliuk@vyos.io>2023-03-10 10:38:18 +0200
commit72ef87421bd472a0eecf22b24d10277180c7a1f3 (patch)
tree307fe7411e36ef0ac007ab54fe4b88136e419bd3 /python/vyos
parentfe4da6288649b32779d30d5672e39cae40e72100 (diff)
downloadvyos-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.py6
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: