Skip to content

Commit

Permalink
Add check for attachment.attachment_url
Browse files Browse the repository at this point in the history
  • Loading branch information
lonekorean committed Feb 27, 2024
1 parent 6ca1f69 commit f1b29c1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function getPostCoverImageId(postData) {
function collectAttachedImages(channelData) {
const images = getItemsOfType(channelData, 'attachment')
// filter to certain image file types
.filter(attachment => (/\.(gif|jpe?g|png)$/i).test(attachment.attachment_url[0]))
.filter(attachment => attachment.attachment_url && (/\.(gif|jpe?g|png)$/i).test(attachment.attachment_url[0]))
.map(attachment => ({
id: attachment.post_id[0],
postId: attachment.post_parent[0],
Expand Down

0 comments on commit f1b29c1

Please sign in to comment.