fix: users see the default image for a router model shared with them (#34796)

A router model with its own profile image showed the default logo to every user it was shared with or made public for, and only admins saw the uploaded image. The image now follows the same access as the router model itself, so anyone who can see and chat with it in the model selector also sees its image, and users it is not shared with still get the default logo.

Fixes #34793
This commit is contained in:
Classic298 authored and GitHub committed 2026-11-23 18:40:04 +04:00
1 parent c11a16f448
commit 2cfccb1cef
1 file changed
+4 -7
+4 -7
View File
@@ -47,7 +47,6 @@ from open_webui.models.models import (
from open_webui.storage.provider import Storage
from open_webui.utils.access_control import (
filter_allowed_access_grants,
has_access,
has_permission,
validate_access_grants,
)
@@ -979,6 +978,8 @@ async def get_model_profile_image(
# First, check the database for regular models
model_meta = await Models.get_model_meta_by_id(id, db=db)
# As in the model list, a model without a row is visible to admins only.
read_access = bypass_access_control or (not model_meta and user.role == 'admin')
if model_meta:
meta, model_user_id, model_updated_at = model_meta
# Denied callers get the default image rather than an error, so model ids stay unprobeable.
@@ -993,6 +994,7 @@ async def get_model_profile_image(
db=db,
)
):
read_access = True
profile_image_url = (meta or {}).get('profile_image_url')
updated_at = model_updated_at
@@ -1002,12 +1004,7 @@ async def get_model_profile_image(
for router_model in router_models:
if router_model.get('id') == id:
router_meta = router_model.get('meta', {})
access_grants = router_meta.get('access_grants', [])
if (
bypass_access_control
or (not access_grants and user.role == 'admin')
or await has_access(user.id, permission='read', access_grants=access_grants, db=db)
):
if read_access:
profile_image_url = router_meta.get('profile_image_url')
break