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 9ae68ade8b.
This commit is contained in:
Tim Abbott
2017-01-29 12:48:10 -08:00
parent 234eb7a723
commit 70af09539f

View File

@@ -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")