From 17cc566707cd2ee78b460e39c7fad23b9c258c70 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 27 Aug 2026 19:23:44 -0400 Subject: [PATCH] refac --- backend/open_webui/models/users.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/models/users.py b/backend/open_webui/models/users.py index 3d132c529e..b7633759f5 100644 --- a/backend/open_webui/models/users.py +++ b/backend/open_webui/models/users.py @@ -367,7 +367,9 @@ class UsersTable: query = select(User).where(sub_expr == sub) # SQLite preserves JSON numeric type here; Postgres ->> already compares numeric JSON as text. if session.get_bind().dialect.name == 'sqlite' and sub.isdecimal(): - query = select(User).where(or_(sub_expr == sub, sub_expr == int(sub))) + sub_int = int(sub) + if str(sub_int) == sub and sub_int <= 2**63 - 1: + query = select(User).where(or_(sub_expr == sub, sub_expr == sub_int)) row = (await session.execute(query)).scalars().first() return UserModel.model_validate(row) if row else None