Skip to content

Commit

Permalink
Properly escape page part contents in the UI.
Browse files Browse the repository at this point in the history
  • Loading branch information
seancribbs committed Feb 12, 2009
1 parent e88f129 commit 300ffd5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/admin/page_parts/_page_part.html.haml
Expand Up @@ -12,4 +12,4 @@
= link_to_function 'Available Tags', "load_tag_reference('#{page_part.name.to_slug}');"
= render_region :part_controls, :locals => {:page_part => page_part}
%div
~ text_area_tag 'page[parts][][content]', page_part.content, :class => "textarea", :style => "width: 100%", :id => "part_#{page_part.name.to_slug}_content"
~ text_area_tag 'page[parts][][content]', h(page_part.content), :class => "textarea", :style => "width: 100%", :id => "part_#{page_part.name.to_slug}_content"
6 changes: 6 additions & 0 deletions spec/integration/admin/pages_integration_spec.rb
Expand Up @@ -34,6 +34,12 @@ def have_slug(expected)
response.should have_text(/Under Construction/)
end

it "should properly escape part contents" do
navigate_to '/admin/pages/new'
submit_form 'new_page', :continue => 'Save and Continue', :page => {:title => 'My Site', :slug => '/', :breadcrumb => 'My Site', :parts => [{:name => 'body', :content => '<r:url />'}], :status_id => Status[:published].id}
response.should have_tag('textarea', :text => "<r:url />")
end

describe 'with homepage' do
dataset :home_page

Expand Down

0 comments on commit 300ffd5

Please sign in to comment.