Escaping page title in RSS feeds (ticket:143)

This commit is contained in:
Alexey Verkhovsky 2005-04-28 05:10:58 +00:00
parent 69c839e70a
commit eae0312932
2 changed files with 14 additions and 1 deletions

View file

@ -8,7 +8,7 @@
<ttl>40</ttl> <ttl>40</ttl>
<% for page in @pages_by_revision %> <% for page in @pages_by_revision %>
<item> <item>
<title><%= page.plain_name %></title> <title><%= h page.plain_name %></title>
<% unless @hide_description %> <% unless @hide_description %>
<description><%= h page.display_content %></description> <description><%= h page.display_content %></description>
<% end %> <% end %>

View file

@ -462,6 +462,19 @@ class WikiControllerTest < Test::Unit::TestCase
pages = r.template_objects['pages_by_revision'] pages = r.template_objects['pages_by_revision']
assert_equal 5, pages.size assert_equal 5, pages.size
end end
def test_rss_title_with_ampersand
# was ticket:143
setup_wiki_with_three_pages
@wiki.write_page('wiki1', 'Title&With&Ampersands',
'About spaces', 1.hour.ago, Author.new('NitPicker', '127.0.0.3'))
r = process 'rss_with_headlines', 'web' => 'wiki1'
assert r.body.include?('<title>Home Page</title>')
assert r.body.include?('<title>Title&amp;With&amp;Ampersands</title>')
end
def test_save def test_save
r = process 'save', 'web' => 'wiki1', 'id' => 'NewPage', 'content' => 'Contents of a new page', r = process 'save', 'web' => 'wiki1', 'id' => 'NewPage', 'content' => 'Contents of a new page',