Decode error messages before trying to use them.

This commit is contained in:
Dave Page 2017-03-24 14:11:31 +00:00
parent 5f2a15dd6d
commit 6cb9ece6fd

View File

@ -788,15 +788,15 @@ class ServerNode(PGChildNodeView):
) )
if not status: if not status:
if hasattr(str, 'decode'):
errmsg = errmsg.decode('utf-8')
current_app.logger.error( current_app.logger.error(
"Could not connected to server(#{0}) - '{1}'.\nError: {2}".format( "Could not connected to server(#{0}) - '{1}'.\nError: {2}".format(
server.id, server.name, errmsg server.id, server.name, errmsg
) )
) )
if hasattr(str, 'decode'):
errmsg = errmsg.decode('utf-8')
return make_json_response( return make_json_response(
success=0, success=0,
status=401, status=401,