From d1aa9fe441b8da0644bf073a8b4c44b792174276 Mon Sep 17 00:00:00 2001 From: SergeantPanda Date: Mon, 6 Oct 2025 21:22:16 -0500 Subject: [PATCH] Bug fix: Add logo URL validation to prevent PostgreSQL btree index errors during channel creation from stream --- apps/channels/api_views.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/channels/api_views.py b/apps/channels/api_views.py index 0c562974..862de7f9 100644 --- a/apps/channels/api_views.py +++ b/apps/channels/api_views.py @@ -747,10 +747,14 @@ class ChannelViewSet(viewsets.ModelViewSet): channel_data["channel_group_id"] = channel_group.id if stream.logo_url: - logo, _ = Logo.objects.get_or_create( - url=stream.logo_url, defaults={"name": stream.name or stream.tvg_id} - ) - channel_data["logo_id"] = logo.id + # Import validation function + from apps.channels.tasks import validate_logo_url + validated_logo_url = validate_logo_url(stream.logo_url) + if validated_logo_url: + logo, _ = Logo.objects.get_or_create( + url=validated_logo_url, defaults={"name": stream.name or stream.tvg_id} + ) + channel_data["logo_id"] = logo.id # Attempt to find existing EPGs with the same tvg-id epgs = EPGData.objects.filter(tvg_id=stream.tvg_id)