Skip to content

Commit e545d67

Browse files
committed
fix(cloudrun): add feedback from code-assist
- Add a try-except block to handle potential ValueError.
1 parent 3b22aaa commit e545d67

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

run/service-auth/app.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ def parse_auth_header(auth_header: str) -> Optional[str]:
7474
"""
7575

7676
# Split the auth type and value from the header.
77-
auth_type, creds = auth_header.split(" ", 1)
77+
try:
78+
auth_type, creds = auth_header.split(" ", 1)
79+
except ValueError:
80+
print("Malformed Authorization header.")
81+
return None
7882

7983
# The token audience will be the SERVICE_URL.
8084
# If `audience` was None, it won't be verified.

0 commit comments

Comments
 (0)