Skip to content

Commit

Permalink
Merge pull request #1017 from NagiosEnterprises/bb_fixunicodeerror
Browse files Browse the repository at this point in the history
Py3 strings are already unicode, fixing error output in logs
  • Loading branch information
ne-bbahn committed Nov 13, 2023
2 parents 4a9f1a4 + 2b33c4e commit e27b355
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions agent/listener/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@ def is_network(ip):
def secure_compare(item1, item2):
is_match = False

# Convert to unicode, if necessary, both items must have the same encoding
if item1 and not isinstance(item1, unicode):
item1 = item1.decode('utf-8')
if item2 and not isinstance(item2, unicode):
item2 = item2.decode('utf-8')
# In Python 3, strings are unicode by default
if item1:
item1 = str(item1)
if item2:
item2 = str(item2)

if item1 and item2 and compare_digest(item1, item2):
is_match = True
Expand Down

0 comments on commit e27b355

Please sign in to comment.