From 4e618c2c293a34e819ca81cfb53ccd64f71f6521 Mon Sep 17 00:00:00 2001 From: Leandro Nunes dos Santos Date: Thu, 5 May 2016 17:48:58 -0300 Subject: [PATCH] fix html escape of article in plugin comment paragraph --- plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb | 8 ++++++++ plugins/comment_paragraph/views/comment_paragraph_plugin_profile/_comment_paragraph.html.erb | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb b/plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb index 01c6363..24b339c 100644 --- a/plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb +++ b/plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb @@ -26,4 +26,12 @@ class ContentViewerControllerTest < ActionController::TestCase assert_tag 'div', :attributes => {:class => 'comment_paragraph'} end + should 'parse article body with correct html escape' do + comment1 = fast_create(Comment, :paragraph_uuid => 0, :source_id => page.id) + @page.body='

inner text

' + @page.save + get :view_page, @page.url + assert_tag 'div', :content => 'inner text', :attributes => {:class => 'comment_paragraph'} + end + end diff --git a/plugins/comment_paragraph/views/comment_paragraph_plugin_profile/_comment_paragraph.html.erb b/plugins/comment_paragraph/views/comment_paragraph_plugin_profile/_comment_paragraph.html.erb index b698151..6f2b2cf 100644 --- a/plugins/comment_paragraph/views/comment_paragraph_plugin_profile/_comment_paragraph.html.erb +++ b/plugins/comment_paragraph/views/comment_paragraph_plugin_profile/_comment_paragraph.html.erb @@ -1,7 +1,5 @@
-
- <%= inner_html %> -
+
<%= inner_html.html_safe %>
'> -- libgit2 0.21.2