From eb9f5882167058ddf754803b3506e3fce61090b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Guillot?= Date: Mon, 20 Nov 2017 19:25:30 -0800 Subject: [PATCH] Make sure RDF entries have a date --- reader/rdf/parser_test.go | 5 +++++ reader/rdf/rdf.go | 2 ++ 2 files changed, 7 insertions(+) diff --git a/reader/rdf/parser_test.go b/reader/rdf/parser_test.go index dadca6f0..bad3ed78 100644 --- a/reader/rdf/parser_test.go +++ b/reader/rdf/parser_test.go @@ -8,6 +8,7 @@ import ( "bytes" "strings" "testing" + "time" "github.com/miniflux/miniflux2/errors" ) @@ -113,6 +114,10 @@ func TestParseRDFSample(t *testing.T) { if strings.HasSuffix(feed.Entries[1].Content, "Tool and API support") { t.Errorf("Incorrect entry content, got: %s", feed.Entries[0].Content) } + + if feed.Entries[1].Date.Year() != time.Now().Year() { + t.Errorf("Entry date should not be empty") + } } func TestParseRDFSampleWithDublinCore(t *testing.T) { diff --git a/reader/rdf/rdf.go b/reader/rdf/rdf.go index 05281ca0..8622d66f 100644 --- a/reader/rdf/rdf.go +++ b/reader/rdf/rdf.go @@ -6,6 +6,7 @@ package rdf import ( "encoding/xml" + "time" "github.com/miniflux/miniflux2/helper" "github.com/miniflux/miniflux2/reader/processor" @@ -58,6 +59,7 @@ func (r *rdfItem) Transform() *model.Entry { entry.URL = r.Link entry.Content = processor.ItemContentProcessor(entry.URL, r.Description) entry.Hash = getHash(r) + entry.Date = time.Now() return entry }