summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-11-28 17:56:50 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-11-28 17:56:50 +0000
commit9f15517095c4877ce5ae798210b8f5204a157ec9 (patch)
treea58911ba3b59bdb0e885fdd5ec7460edb783212a
parent5c60a4f6ca92051850ec86a7cad6e12d2b7451ac (diff)
downloadredmine-9f15517095c4877ce5ae798210b8f5204a157ec9.tar.gz
redmine-9f15517095c4877ce5ae798210b8f5204a157ec9.zip
Fixed: Angle brackets within 'pre' blocks are silently replaced by HTML entities during wiki section-edit (#9673).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7969 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--lib/redmine/wiki_formatting/textile/formatter.rb2
-rw-r--r--test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb10
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/redmine/wiki_formatting/textile/formatter.rb b/lib/redmine/wiki_formatting/textile/formatter.rb
index 1beb9563c..0e948cfd5 100644
--- a/lib/redmine/wiki_formatting/textile/formatter.rb
+++ b/lib/redmine/wiki_formatting/textile/formatter.rb
@@ -57,7 +57,7 @@ module Redmine
def extract_sections(index)
@pre_list = []
text = self.dup
- rip_offtags text
+ rip_offtags text, false
before = ''
s = ''
after = ''
diff --git a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
index ec9b883b0..853b0d522 100644
--- a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
+++ b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
@@ -286,6 +286,8 @@ Pre Content:
h2. Inside pre
+<tag> inside pre block
+
Morbi facilisis accumsan orci non pharetra.
</pre>",
# 2
@@ -300,6 +302,14 @@ Nulla nunc nisi, egestas in ornare vel, posuere ac libero."]
assert_section_with_hash STR_WITH_PRE[2], text, 3
end
+ def test_update_section_should_not_escape_pre_content_outside_section
+ text = STR_WITH_PRE.join("\n\n")
+ replacement = "New text"
+
+ assert_equal [STR_WITH_PRE[0..1], "New text"].flatten.join("\n\n"),
+ @formatter.new(text).update_section(3, replacement)
+ end
+
private
def assert_html_output(to_test, expect_paragraph = true)