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.
This commit is contained in:
@@ -69,7 +69,7 @@ def apply_channel_details(db: Session, items: list[dict]) -> None:
|
|||||||
channel.banner_url = branding.get("image", {}).get("bannerExternalUrl")
|
channel.banner_url = branding.get("image", {}).get("bannerExternalUrl")
|
||||||
channel.external_links = _external_links(branding)
|
channel.external_links = _external_links(branding)
|
||||||
channel.topic_categories = topics.get("topicCategories")
|
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
|
channel.details_synced_at = now
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ function topicLabels(urls: string[]): string[] {
|
|||||||
} catch {
|
} catch {
|
||||||
/* keep raw */
|
/* keep raw */
|
||||||
}
|
}
|
||||||
seen.add(label.replace(/_/g, " "));
|
label = label.replace(/_/g, " ").trim();
|
||||||
|
if (label) seen.add(label);
|
||||||
}
|
}
|
||||||
return [...seen];
|
return [...seen];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user