From 85575917ff85b9d24f7fe59fae98bddfae04f715 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Thu, 3 Aug 2023 22:21:11 +0800 Subject: [PATCH] use published or updated if isoDate is not available for atom feeds --- packages/rss-handler/src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/rss-handler/src/index.ts b/packages/rss-handler/src/index.ts index f4597b98e..fd64afb00 100644 --- a/packages/rss-handler/src/index.ts +++ b/packages/rss-handler/src/index.ts @@ -119,7 +119,7 @@ Sentry.GCPFunction.init({ const signToken = promisify(jwt.sign) const parser = new Parser({ customFields: { - item: [['link', 'links', { keepArray: true }]], + item: [['link', 'links', { keepArray: true }], 'published', 'updated'], }, }) @@ -192,6 +192,9 @@ export const rssHandler = Sentry.GCPFunction.wrapHttpFunction( // save each item in the feed for (const item of feed.items) { + // use published or updated if isoDate is not available for atom feeds + item.isoDate = + item.isoDate || (item.published as string) || (item.updated as string) console.log('Processing feed item', item.links, item.isoDate) if (!item.links || item.links.length === 0) {