From 60174b63c6bf3f71ca7120c35148b8225f724252 Mon Sep 17 00:00:00 2001 From: npeter83 Date: Sun, 12 Jul 2026 16:17:17 +0200 Subject: [PATCH] fix(channel): harden About-enrich edge cases from review - apply_channel_details: (branding.get("channel") or {}) so a "channel": null in brandingSettings can't AttributeError-abort the enrich batch. - topicLabels: drop empty labels so a malformed topic URL can't render a blank chip. --- backend/app/sync/subscriptions.py | 2 +- frontend/src/components/ChannelPage.tsx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/app/sync/subscriptions.py b/backend/app/sync/subscriptions.py index 3638eea..e8b98cc 100644 --- a/backend/app/sync/subscriptions.py +++ b/backend/app/sync/subscriptions.py @@ -69,7 +69,7 @@ def apply_channel_details(db: Session, items: list[dict]) -> None: channel.banner_url = branding.get("image", {}).get("bannerExternalUrl") channel.external_links = _external_links(branding) channel.topic_categories = topics.get("topicCategories") - channel.keywords = branding.get("channel", {}).get("keywords") + channel.keywords = (branding.get("channel") or {}).get("keywords") channel.details_synced_at = now diff --git a/frontend/src/components/ChannelPage.tsx b/frontend/src/components/ChannelPage.tsx index 5ad3ea1..25aaf63 100644 --- a/frontend/src/components/ChannelPage.tsx +++ b/frontend/src/components/ChannelPage.tsx @@ -38,7 +38,8 @@ function topicLabels(urls: string[]): string[] { } catch { /* keep raw */ } - seen.add(label.replace(/_/g, " ")); + label = label.replace(/_/g, " ").trim(); + if (label) seen.add(label); } return [...seen]; }