summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/redmine/wiki_formatting/textile/redcloth3.rb2
-rw-r--r--test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb6
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb
index 2349a0b84..6ffd7c78c 100644
--- a/lib/redmine/wiki_formatting/textile/redcloth3.rb
+++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb
@@ -1034,7 +1034,7 @@ class RedCloth3 < String
def flush_left( text )
indt = 0
if text =~ /^ /
- while text !~ /^ {#{indt}}\S/
+ while text !~ /^ {#{indt}}[^ ]/
indt += 1
end unless text.empty?
if indt.nonzero?
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 cc31a4c80..a4c8167d1 100644
--- a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
+++ b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
@@ -599,6 +599,12 @@ EXPECTED
assert_equal expected.gsub(%r{[\r\n\t]}, ''), to_html(text).gsub(%r{[\r\n\t]}, '')
end
+ # TODO: Remove this test after migrating to RedCloth 4
+ def test_should_not_crash_with_special_input
+ assert_nothing_raised { to_html(" \f") }
+ assert_nothing_raised { to_html(" \v") }
+ end
+
private
def assert_html_output(to_test, expect_paragraph = true)