Skip to content

Commit

Permalink
fix - check if its array before 'find'
Browse files Browse the repository at this point in the history
  • Loading branch information
adriangohjw committed Jan 2, 2025
1 parent 9179dbc commit 3474cb6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tooling/build/scripts/publishing/utils/getResourceImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import type { Resource } from "../types"
export const getResourceImage = (resource: Resource) => {
if (resource.content.page.image) return resource.content.page.image

if (!Array.isArray(resource.content)) return undefined

const firstImageComponent = resource.content.find(
(item: any) => item.type === "image",
)
Expand Down

0 comments on commit 3474cb6

Please sign in to comment.