diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb index 2ac134c0a..6d462e935 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 43ee83ce5..24098b782 100644 --- a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb @@ -580,6 +580,12 @@ STR }, false) 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)