From d06e6d6ddc520f6e91244264a38457da87f73247 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Fri, 8 May 2026 20:19:25 +0200 Subject: [PATCH] Apply validate_profile_image_url to ChannelWebhookForm.profile_image_url (#24370) --- backend/open_webui/models/channels.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/models/channels.py b/backend/open_webui/models/channels.py index 942c06d6b3..adeaeaf9da 100644 --- a/backend/open_webui/models/channels.py +++ b/backend/open_webui/models/channels.py @@ -4,6 +4,8 @@ import time import uuid from typing import Optional +from open_webui.utils.validate import validate_profile_image_url + from sqlalchemy import select, delete, update, func, case, or_, and_ from sqlalchemy.ext.asyncio import AsyncSession from open_webui.internal.db import Base, JSONField, get_async_db_context @@ -13,7 +15,7 @@ from open_webui.models.access_grants import ( AccessGrants, ) -from pydantic import BaseModel, ConfigDict, Field +from pydantic import BaseModel, ConfigDict, Field, field_validator from sqlalchemy.dialects.postgresql import JSONB @@ -244,6 +246,13 @@ class ChannelWebhookForm(BaseModel): name: str profile_image_url: Optional[str] = None + @field_validator('profile_image_url', mode='before') + @classmethod + def check_profile_image_url(cls, v: Optional[str]) -> Optional[str]: + if v is None: + return v + return validate_profile_image_url(v) + class ChannelTable: async def _get_access_grants(self, channel_id: str, db: Optional[AsyncSession] = None) -> list[AccessGrantModel]: