mirror of
https://github.com/miniflux/v2.git
synced 2025-06-27 16:36:00 +00:00
fix: do not strip tags in Atom entry title
This commit is contained in:
parent
c9c422b135
commit
9c82e55b98
2 changed files with 15 additions and 5 deletions
|
@ -9,7 +9,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"miniflux.app/v2/internal/reader/media"
|
||||
"miniflux.app/v2/internal/reader/sanitizer"
|
||||
)
|
||||
|
||||
// The "atom:feed" element is the document (i.e., top-level) element of
|
||||
|
@ -188,7 +187,6 @@ func (a *Atom10Text) Title() string {
|
|||
content = a.CharData
|
||||
}
|
||||
|
||||
content = sanitizer.StripTags(content)
|
||||
return strings.TrimSpace(content)
|
||||
}
|
||||
|
||||
|
|
|
@ -492,6 +492,10 @@ func TestParseEntryWithHTMLTitle(t *testing.T) {
|
|||
</title>
|
||||
<link href="http://example.org/c"/>
|
||||
</entry>
|
||||
<entry>
|
||||
<title type="html"><![CDATA[Test with self-closing <tag>]]></title>
|
||||
<link href="http://example.org/d"/>
|
||||
</entry>
|
||||
</feed>`
|
||||
|
||||
feed, err := Parse("https://example.org/", bytes.NewReader([]byte(data)), "10")
|
||||
|
@ -499,7 +503,11 @@ func TestParseEntryWithHTMLTitle(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if feed.Entries[0].Title != "Code Test" {
|
||||
if len(feed.Entries) != 4 {
|
||||
t.Fatalf("Incorrect number of entries, got: %d", len(feed.Entries))
|
||||
}
|
||||
|
||||
if feed.Entries[0].Title != "<code>Code</code> Test" {
|
||||
t.Errorf("Incorrect entry title, got: %q", feed.Entries[0].Title)
|
||||
}
|
||||
|
||||
|
@ -510,6 +518,10 @@ func TestParseEntryWithHTMLTitle(t *testing.T) {
|
|||
if feed.Entries[2].Title != "Entry title with space around CDATA" {
|
||||
t.Errorf("Incorrect entry title, got: %q", feed.Entries[2].Title)
|
||||
}
|
||||
|
||||
if feed.Entries[3].Title != "Test with self-closing <tag>" {
|
||||
t.Errorf("Incorrect entry title, got: %q", feed.Entries[3].Title)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseEntryWithXHTMLTitle(t *testing.T) {
|
||||
|
@ -537,7 +549,7 @@ func TestParseEntryWithXHTMLTitle(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if feed.Entries[0].Title != `This is XHTML content.` {
|
||||
if feed.Entries[0].Title != `This is <b>XHTML</b> content.` {
|
||||
t.Errorf("Incorrect entry title, got: %q", feed.Entries[0].Title)
|
||||
}
|
||||
}
|
||||
|
@ -643,7 +655,7 @@ func TestParseEntryWithDoubleEncodedEntitiesTitle(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if feed.Entries[0].Title != `'AT&T'` {
|
||||
if feed.Entries[0].Title != `'AT&T'` {
|
||||
t.Errorf("Incorrect entry title, got: %q", feed.Entries[0].Title)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue