Skip to content

Commit

Permalink
feed: escape title and description
Browse files Browse the repository at this point in the history
We need to escape them to avoid end up in titles like "today & tomorrow"
instead of "today & tomorrow".
  • Loading branch information
jasuarez committed Feb 1, 2017
1 parent bdc7cc7 commit d7c8755
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sigal/plugins/feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@ def generate_feed(gallery, medias, feed_type=None, feed_url='', nb_items=0):
root_album = gallery.albums['.']
cls = Rss201rev2Feed if feed_type == 'rss' else Atom1Feed
feed = cls(
title=Markup(root_album.title),
title=Markup.escape(root_album.title),
link='/',
feed_url=feed_url,
description=Markup(root_album.description).striptags()
description=Markup.escape(root_album.description).striptags()
)

nb_medias = len(medias)
nb_items = min(nb_items, nb_medias) if nb_items > 0 else nb_medias

for item in medias[:nb_items]:
feed.add_item(
title=Markup(item.title or item.url),
title=Markup.escape(item.title or item.url),
link='%s/#%s' % (item.path, item.url),
# unique_id='tag:%s,%s:%s' % (urlparse(link).netloc,
# item.date.date(),
Expand Down

0 comments on commit d7c8755

Please sign in to comment.