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:
parent
8cebd985a2
commit
bf632fad2e
6 changed files with 105 additions and 2 deletions
|
@ -837,6 +837,31 @@ func TestParseEntryWithCommentsURL(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestParseEntryWithInvalidCommentsURL(t *testing.T) {
|
||||
data := `<?xml version="1.0" encoding="utf-8"?>
|
||||
<rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
|
||||
<channel>
|
||||
<link>https://example.org/</link>
|
||||
<item>
|
||||
<title>Item 1</title>
|
||||
<link>https://example.org/item1</link>
|
||||
<comments>
|
||||
Some text
|
||||
</comments>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>`
|
||||
|
||||
feed, err := Parse(bytes.NewBufferString(data))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if feed.Entries[0].CommentsURL != "" {
|
||||
t.Errorf("Incorrect entry comments URL, got: %q", feed.Entries[0].CommentsURL)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseInvalidXml(t *testing.T) {
|
||||
data := `garbage`
|
||||
_, err := Parse(bytes.NewBufferString(data))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue