mirror of
https://github.com/miniflux/v2.git
synced 2025-09-30 19:22:11 +00:00
feat(rss): fallback to enclosure URL when entry URL is missing
This commit is contained in:
parent
33d55cc4e9
commit
d9de9d1852
2 changed files with 35 additions and 1 deletions
|
@ -79,7 +79,13 @@ func (r *RSSAdapter) BuildFeed(baseURL string) *model.Feed {
|
|||
// Populate the entry URL.
|
||||
entryURL := findEntryURL(&item)
|
||||
if entryURL == "" {
|
||||
entry.URL = feed.SiteURL
|
||||
// Fallback to the first enclosure URL if it exists.
|
||||
if len(entry.Enclosures) > 0 && entry.Enclosures[0].URL != "" {
|
||||
entry.URL = entry.Enclosures[0].URL
|
||||
} else {
|
||||
// Fallback to the feed URL if no entry URL is found.
|
||||
entry.URL = feed.SiteURL
|
||||
}
|
||||
} else {
|
||||
if absoluteEntryURL, err := urllib.AbsoluteURL(feed.SiteURL, entryURL); err == nil {
|
||||
entry.URL = absoluteEntryURL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue