fix: prevent null crashes in users and notes routers (#20279)

Add null checks for ui settings in update_user_settings_by_session_user() and for user in get_notes(). Prevents AttributeError when ui dict is None or when note's user has been deleted.
This commit is contained in:
Classic298
2025-12-31 02:30:14 -05:00
committed by GitHub
parent a2e9263af0
commit 2c0ebbcced
2 changed files with 17 additions and 14 deletions
+3 -1
View File
@@ -292,9 +292,11 @@ async def update_user_settings_by_session_user(
db: Session = Depends(get_session),
):
updated_user_settings = form_data.model_dump()
ui_settings = updated_user_settings.get("ui")
if (
user.role != "admin"
and "toolServers" in updated_user_settings.get("ui").keys()
and ui_settings is not None
and "toolServers" in ui_settings.keys()
and not has_permission(
user.id,
"features.direct_tool_servers",