From 70af09539fcd15fea35eaefd4f349481ecd96a04 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Sun, 29 Jan 2017 12:48:10 -0800 Subject: [PATCH] Fix unnecessary traceback in authenticated_rest_api_view. Apparently, we weren't returning the `json_error`, resulting in users encountering this condition receiving a 500, rather than the proper 40x error. This fixes a regresion introduced in 9ae68ade8b514940a49764ac6ecc802a57519d5b. --- zerver/decorator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zerver/decorator.py b/zerver/decorator.py index f2e5689ae4..20428ac6ec 100644 --- a/zerver/decorator.py +++ b/zerver/decorator.py @@ -375,7 +375,7 @@ def authenticated_rest_api_view(is_webhook=False): return json_error(_("Only Basic authentication is supported.")) role, api_key = base64.b64decode(force_bytes(credentials)).decode('utf-8').split(":") except ValueError: - json_error(_("Invalid authorization header for basic auth")) + return json_unauthorized(_("Invalid authorization header for basic auth")) except KeyError: return json_unauthorized("Missing authorization header for basic auth")