Skip to content

Commit

Permalink
Fix panic if article date isn't parsed
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanv committed Aug 22, 2024
1 parent 535c01c commit 63f6a3d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backend/lynx/url_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,12 @@ func handleParseURL(app core.App, c echo.Context) error {
record.Set("article_html", article.Content)
record.Set("raw_text_content", article.TextContent)
record.Set("header_image_url", article.Image)
record.Set("article_date", article.PublishedTime)
record.Set("full_page_html", string(bodyContent))
if article.PublishedTime != nil {
record.Set("article_date", article.PublishedTime)
} else {
record.Set("article_date", time.Now().UTC().Format(time.RFC3339))
}

// Calculate read time, using 285 wpm as read rate
words := strings.Fields(article.TextContent)
Expand Down

0 comments on commit 63f6a3d

Please sign in to comment.