Bladeren bron

fix: initialize sso_login at function start to prevent UnboundLocalError in logout endpoint

The logout handler referenced sso_login in a conditional expression before
it was guaranteed to be assigned, causing 'cannot access local variable'
error. Initialize to None at the top of the function.
kinglee 5 dagen geleden
bovenliggende
commit
20c921ed7e
1 gewijzigde bestanden met toevoegingen van 1 en 0 verwijderingen
  1. 1 0
      gpustack/routes/auth.py

+ 1 - 0
gpustack/routes/auth.py

@@ -520,6 +520,7 @@ async def login(
 async def logout(request: Request):
     config: Config = request.app.state.server_config
     external_logout_url = None
+    sso_login = None  # Ensure initialized before any conditional path
     if (
         config.external_auth_type == AuthProviderEnum.OIDC
         and config.openid_configuration