From 122bfd666a8e1708dc0185c490ec8d0867a66c66 Mon Sep 17 00:00:00 2001 From: Marcus Noble Date: Sun, 21 Feb 2021 09:09:25 +0000 Subject: [PATCH] Fixed created time nil --- internal/feeds/refresh.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/feeds/refresh.go b/internal/feeds/refresh.go index 78d00fd..d82caa0 100644 --- a/internal/feeds/refresh.go +++ b/internal/feeds/refresh.go @@ -59,6 +59,11 @@ func RefreshFeed(url string) Feed { imageURL = f.Image.URL } + createdTime := item.PublishedParsed + if createdTime == nil { + createdTime = item.UpdatedParsed + } + feed.Items = append(feed.Items, Item{ ID: strings.ReplaceAll(base64.StdEncoding.EncodeToString([]byte(item.GUID)), "/", ""), Title: item.Title, @@ -67,7 +72,7 @@ func RefreshFeed(url string) Feed { URL: item.Link, ImageURL: imageURL, LastUpdated: item.UpdatedParsed, - Created: item.PublishedParsed, + Created: createdTime, GUID: item.GUID, FeedID: feed.ID, })