From d50098b62272203b5999edff735e18fff91a2446 Mon Sep 17 00:00:00 2001 From: Jeannot Damoiseaux <62134006+jeannotdamoiseaux@users.noreply.github.com> Date: Fri, 21 Feb 2025 22:25:22 +0100 Subject: [PATCH] Fix: Ensure `user_oauth_groups` defaults to an empty list to prevent TypeError When the OAuth groups claim does not yield a list, `user_oauth_groups` was previously set to None, causing a TypeError during membership checks. Changed this default to an empty list (`[]`) to ensure the variable is always iterable, preventing errors for non-admin users while logging in. This fix ensures stability in the `update_user_groups` function. --- backend/open_webui/utils/oauth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/open_webui/utils/oauth.py b/backend/open_webui/utils/oauth.py index 13835e784..0b68be2de 100644 --- a/backend/open_webui/utils/oauth.py +++ b/backend/open_webui/utils/oauth.py @@ -146,7 +146,7 @@ class OAuthManager: nested_claims = oauth_claim.split(".") for nested_claim in nested_claims: claim_data = claim_data.get(nested_claim, {}) - user_oauth_groups = claim_data if isinstance(claim_data, list) else None + user_oauth_groups = claim_data if isinstance(claim_data, list) else [] user_current_groups: list[GroupModel] = Groups.get_groups_by_member_id(user.id) all_available_groups: list[GroupModel] = Groups.get_groups()