From 603c3bcbf2505c94d8951cf4a85b7dfe08fcf8e7 Mon Sep 17 00:00:00 2001 From: nmemmert Date: Thu, 11 Jun 2026 14:45:47 -0400 Subject: [PATCH] Fix commentary JSON parse error for chapters without coverage --- src/App.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/App.jsx b/src/App.jsx index 1717769..55ac323 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -931,7 +931,8 @@ const App = () => { const cacheKey = `${commentaryId}/${bookAbbrev}/${chapterNumber}`; if (_commentaryCacheRef.current[cacheKey]) return _commentaryCacheRef.current[cacheKey]; const res = await fetch(`https://bible.helloao.org/api/c/${commentaryId}/${bookAbbrev}/${chapterNumber}.json`); - if (!res.ok) throw new Error(`No ${commentaryId} commentary for this chapter.`); + const contentType = res.headers.get('content-type') || ''; + if (!res.ok || !contentType.includes('json')) throw new Error(`No ${commentaryId} commentary for this chapter.`); const data = await res.json(); _commentaryCacheRef.current[cacheKey] = data; return data;