浏览代码

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 天之前
父节点
当前提交
20c921ed7e
共有 1 个文件被更改,包括 1 次插入0 次删除
  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