From 1e446c9382e7de4ec7ffe20263f17a861934a14b Mon Sep 17 00:00:00 2001 From: Marcin Kuzminski Date: Tue, 18 Dec 2018 11:42:52 +0100 Subject: [PATCH] api: fixed potential crash when returning error response using JSON objects that fail to parse. --- rhodecode/api/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rhodecode/api/__init__.py b/rhodecode/api/__init__.py index 6a9898a0..27cab4c6 100644 --- a/rhodecode/api/__init__.py +++ b/rhodecode/api/__init__.py @@ -142,13 +142,13 @@ def exception_view(exc, request): fault_message = 'undefined error' if isinstance(exc, JSONRPCError): - fault_message = exc.message + fault_message = safe_str(exc.message) log.debug('json-rpc error rpc_id:%s "%s"', rpc_id, fault_message) elif isinstance(exc, JSONRPCValidationError): colander_exc = exc.colander_exception # TODO(marcink): think maybe of nicer way to serialize errors ? fault_message = colander_exc.asdict() - log.debug('json-rpc error rpc_id:%s "%s"', rpc_id, fault_message) + log.debug('json-rpc colander error rpc_id:%s "%s"', rpc_id, fault_message) elif isinstance(exc, JSONRPCForbidden): fault_message = 'Access was denied to this resource.' log.warning('json-rpc forbidden call rpc_id:%s "%s"', rpc_id, fault_message)