mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
Handle atom feed with space around CDATA
Trim space around CDATA elements before extracting the CharData. This problem was discovered when reading https://www.sethvargo.com/feed.xml. Title and Summary fields have newlines and space between the <title> element and the CDATA element. e.g. <title> <![CDATA[Entry title here]]> </title> This meant the title of the feed was coming into MiniFlux as, <![CDATA[Entry title here]]>
This commit is contained in:
parent
7b0a4a7803
commit
cc3e65dd3c
2 changed files with 15 additions and 2 deletions
|
@ -229,10 +229,9 @@ type atom10Text struct {
|
|||
|
||||
func (a *atom10Text) String() string {
|
||||
var content string
|
||||
|
||||
switch {
|
||||
case a.Type == "", a.Type == "text", a.Type == "text/plain":
|
||||
if strings.HasPrefix(a.InnerXML, `<![CDATA[`) {
|
||||
if strings.HasPrefix(strings.TrimSpace(a.InnerXML), `<![CDATA[`) {
|
||||
content = html.EscapeString(a.CharData)
|
||||
} else {
|
||||
content = a.InnerXML
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue