Skip to content
Permalink
Browse files

Escape text atom titles

  • Loading branch information...
mjibson committed Feb 25, 2014
1 parent d84661c commit e1f3af074e83de69e9daf1c5b77eb9ed55913c59
Showing with 9 additions and 2 deletions.
  1. +1 −1 atom/atom.go
  2. +8 −1 utils.go
@@ -24,7 +24,7 @@ type Feed struct {
}

type Entry struct {
Title string `xml:"title"`
Title *Text `xml:"title"`
ID string `xml:"id"`
Link []Link `xml:"link"`
Published TimeStr `xml:"published"`
@@ -391,7 +391,7 @@ func ParseFeed(c appengine.Context, origUrl, fetchUrl string, b []byte) (*Feed,
}
st := Story{
Id: i.ID,
Title: i.Title,
Title: atomTitle(i.Title),
}
if t, err := parseDate(c, &f, string(i.Updated)); err == nil {
st.Updated = t
@@ -518,6 +518,13 @@ func textTitle(t string) string {
return html.UnescapeString(t)
}

func atomTitle(t *atom.Text) string {
if t.Type == "text" {
return textTitle(t.Body)
}
return t.Body
}

func findBestAtomLink(c appengine.Context, links []atom.Link) string {
getScore := func(l atom.Link) int {
switch {

0 comments on commit e1f3af0

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.