api: fix error when authorization is empty

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-04-13 21:41:26 +02:00
parent 5a25e6d697
commit 3d9874be69
1 changed files with 2 additions and 0 deletions

View File

@ -15,6 +15,8 @@ LOGGER = get_logger()
def token_from_header(raw_header: bytes) -> Optional[Token]: def token_from_header(raw_header: bytes) -> Optional[Token]:
"""raw_header in the Format of `Basic dGVzdDp0ZXN0`""" """raw_header in the Format of `Basic dGVzdDp0ZXN0`"""
auth_credentials = raw_header.decode() auth_credentials = raw_header.decode()
if auth_credentials == "":
return None
# Legacy, accept basic auth thats fully encoded (2021.3 outposts) # Legacy, accept basic auth thats fully encoded (2021.3 outposts)
if " " not in auth_credentials: if " " not in auth_credentials:
try: try: