From d16829f45e550d9a1c7d43044c6d0c5be71a8f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20H=C3=A5rek=20Andreassen?= Date: Sat, 30 Mar 2024 15:34:20 +0100 Subject: [PATCH] fix: Check if empty image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apparently this is allowed, although the OpenAPI specification disallows it. Signed-off-by: Tim HÄrek Andreassen --- routes/api/feeds/[seriesId].ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/api/feeds/[seriesId].ts b/routes/api/feeds/[seriesId].ts index 52732a4..8729249 100644 --- a/routes/api/feeds/[seriesId].ts +++ b/routes/api/feeds/[seriesId].ts @@ -30,7 +30,7 @@ function toItemTag(seriesId: string, episode: OriginalEpisode) { async function buildFeed(seriesId: string) { const serie = await nrkRadio.getSerieData(seriesId); - const imageUrl = serie.squareImage.at(-1)?.url; + const imageUrl = serie.squareImage?.at(-1)?.url ?? ""; const linkValue = `https://radio.nrk.no/podkast/${serie.id}`; // Quickly adapted from https://raw.githubusercontent.com/olaven/paperpod/1cde9abd3174b26e126aa74fc5a3b63fd078c0fd/packages/converter/src/rss.ts