From 563136ff0074ea5cecf2ba880631ad353e6aa9e0 Mon Sep 17 00:00:00 2001 From: Artur Moreira Date: Fri, 27 Mar 2026 11:42:02 +0000 Subject: [PATCH] fix(bridge): handle undefined term.description in strip_html Now that _embed works correctly, WordPress returns full wp:term data where some categories have undefined description fields. Guard strip_html against null/undefined input. Co-Authored-By: Paperclip --- bridge/src/services/wp-client.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bridge/src/services/wp-client.ts b/bridge/src/services/wp-client.ts index d6c87b5..3307c57 100644 --- a/bridge/src/services/wp-client.ts +++ b/bridge/src/services/wp-client.ts @@ -12,7 +12,8 @@ import type { const EMBED_VALUE = 'wp:featuredmedia,author,wp:term'; -function strip_html(html: string): string { +function strip_html(html: string | undefined | null): string { + if (!html) return ''; return html.replace(/<[^>]+>/g, '').replace(/&[a-z]+;/gi, ' ').trim(); }