Skip to content

Commit d199c37

Browse files
authored
Protect against unpublished content
1 parent 91ff0d9 commit d199c37

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/lib/utils/api.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ export class ContentWrapper {
7474
res[id] = documentToHtmlString(res[id], {
7575
renderNode: {
7676
[BLOCKS.EMBEDDED_ASSET]: (node) => {
77+
// Add this safety check: If the asset was deleted/unpublished, skip it.
78+
if (!node.data?.target?.fields) {
79+
return "";
80+
}
81+
7782
const { file, title, description } =
7883
node.data.target.fields;
7984
return `

0 commit comments

Comments
 (0)