mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
fix for route checks
This commit is contained in:
parent
54aa100b47
commit
cd4e923b42
1 changed files with 18 additions and 14 deletions
|
@ -23,11 +23,15 @@ class RouteChecks:
|
||||||
"""
|
"""
|
||||||
Raises Exception if Virtual Key is not allowed to call the route
|
Raises Exception if Virtual Key is not allowed to call the route
|
||||||
"""
|
"""
|
||||||
if (
|
|
||||||
valid_token.allowed_routes
|
# Only check if valid_token.allowed_routes is set and is a list with at least one item
|
||||||
and isinstance(valid_token.allowed_routes, list)
|
if valid_token.allowed_routes is None:
|
||||||
and len(valid_token.allowed_routes) > 0
|
return True
|
||||||
):
|
if not isinstance(valid_token.allowed_routes, list):
|
||||||
|
return True
|
||||||
|
if len(valid_token.allowed_routes) == 0:
|
||||||
|
return True
|
||||||
|
|
||||||
# explicit check for allowed routes
|
# explicit check for allowed routes
|
||||||
if route in valid_token.allowed_routes:
|
if route in valid_token.allowed_routes:
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue