1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-06-27 16:36:00 +00:00

Allow only absolute URLs in comments URL

Some feeds are using invalid URLs (random text).
This commit is contained in:
Frédéric Guillot 2020-01-04 15:18:24 -08:00
parent 8cebd985a2
commit bf632fad2e
6 changed files with 105 additions and 2 deletions

View file

@ -317,7 +317,12 @@ func (r *rssItem) entryEnclosures() model.EnclosureList {
func (r *rssItem) entryCommentsURL() string {
for _, commentLink := range r.CommentLinks {
if commentLink.XMLName.Space == "" {
return strings.TrimSpace(commentLink.Data)
commentsURL := strings.TrimSpace(commentLink.Data)
// The comments URL is supposed to be absolute (some feeds publishes incorrect comments URL)
// See https://cyber.harvard.edu/rss/rss.html#ltcommentsgtSubelementOfLtitemgt
if url.IsAbsoluteURL(commentsURL) {
return commentsURL
}
}
}