fix for route checks

This commit is contained in:
Ishaan Jaff 2025-04-16 18:05:32 -07:00
parent 54aa100b47
commit cd4e923b42

View file

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