Fix error handling
This commit is contained in:
parent
7f2ac0ff6b
commit
2467612e42
|
@ -51,10 +51,8 @@ def process_combined(combined):
|
||||||
def get_token(input_token):
|
def get_token(input_token):
|
||||||
token = input_token.lstrip("Basic ")
|
token = input_token.lstrip("Basic ")
|
||||||
token = b64decode(token).decode('utf8', 'ignore')
|
token = b64decode(token).decode('utf8', 'ignore')
|
||||||
try:
|
with cherrypy.HTTPError.handle(ValueError, 401):
|
||||||
_, token = token.split(":", 2)
|
_, token = token.split(":", 2)
|
||||||
except ValueError:
|
|
||||||
raise cherrypy.HTTPError(401, 'Unauthorized')
|
|
||||||
return token
|
return token
|
||||||
|
|
||||||
class Root:
|
class Root:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user