Make sure RDF entries have a date

This commit is contained in:
Frédéric Guillot 2017-11-20 19:25:30 -08:00
parent d5838b6734
commit eb9f588216
2 changed files with 7 additions and 0 deletions

View file

@ -8,6 +8,7 @@ import (
"bytes" "bytes"
"strings" "strings"
"testing" "testing"
"time"
"github.com/miniflux/miniflux2/errors" "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") { if strings.HasSuffix(feed.Entries[1].Content, "Tool and API support") {
t.Errorf("Incorrect entry content, got: %s", feed.Entries[0].Content) 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) { func TestParseRDFSampleWithDublinCore(t *testing.T) {

View file

@ -6,6 +6,7 @@ package rdf
import ( import (
"encoding/xml" "encoding/xml"
"time"
"github.com/miniflux/miniflux2/helper" "github.com/miniflux/miniflux2/helper"
"github.com/miniflux/miniflux2/reader/processor" "github.com/miniflux/miniflux2/reader/processor"
@ -58,6 +59,7 @@ func (r *rdfItem) Transform() *model.Entry {
entry.URL = r.Link entry.URL = r.Link
entry.Content = processor.ItemContentProcessor(entry.URL, r.Description) entry.Content = processor.ItemContentProcessor(entry.URL, r.Description)
entry.Hash = getHash(r) entry.Hash = getHash(r)
entry.Date = time.Now()
return entry return entry
} }