Act as if there is an author in the feed when only checking the entry
This commit is contained in:
parent
2ef8d8c9df
commit
6b9d5be734
16
entry.go
16
entry.go
@ -34,13 +34,15 @@ type Entry struct {
|
|||||||
// the atom:entry contains an atom:source element that contains an atom:author
|
// the atom:entry contains an atom:source element that contains an atom:author
|
||||||
// element or, in an Atom Feed Document, the atom:feed element contains an
|
// element or, in an Atom Feed Document, the atom:feed element contains an
|
||||||
// atom:author element itself.
|
// atom:author element itself.
|
||||||
func (e *Entry) checkAuthors() error {
|
func (e *Entry) checkAuthors(authorInFeed bool) error {
|
||||||
if e.Authors == nil {
|
if e.Authors == nil {
|
||||||
if e.Source == nil {
|
if !authorInFeed {
|
||||||
return errors.New("no authors set in entry")
|
if e.Source == nil {
|
||||||
}
|
return errors.New("no authors set in entry")
|
||||||
if e.Source.Authors == nil {
|
}
|
||||||
return errors.New("no authors set in entry")
|
if e.Source.Authors == nil {
|
||||||
|
return errors.New("no authors set in entry")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for i, a := range e.Authors {
|
for i, a := range e.Authors {
|
||||||
@ -138,7 +140,7 @@ func (e *Entry) Check() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := e.checkAuthors(); err != nil {
|
if err := e.checkAuthors(true); err != nil {
|
||||||
return fmt.Errorf("entry %v: %v", e.ID.URI, err)
|
return fmt.Errorf("entry %v: %v", e.ID.URI, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
feed.go
2
feed.go
@ -128,7 +128,7 @@ func (f *Feed) Check() error {
|
|||||||
// least one atom:author element.
|
// least one atom:author element.
|
||||||
if f.Authors == nil {
|
if f.Authors == nil {
|
||||||
for _, e := range f.Entries {
|
for _, e := range f.Entries {
|
||||||
if err := e.checkAuthors(); err != nil {
|
if err := e.checkAuthors(false); err != nil {
|
||||||
return fmt.Errorf("no authors set in feed %v: %v", f.ID.URI, err)
|
return fmt.Errorf("no authors set in feed %v: %v", f.ID.URI, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user