Browse Source

Fixed unsafe call to #casecmp (#20369, #21000).

git-svn-id: http://svn.redmine.org/redmine/trunk@14676 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/3.2.0
Jean-Philippe Lang 8 years ago
parent
commit
bae4b1985d
2 changed files with 7 additions and 1 deletions
  1. 1
    1
      app/helpers/application_helper.rb
  2. 6
    0
      test/unit/helpers/application_helper_test.rb

+ 1
- 1
app/helpers/application_helper.rb View File

@@ -609,7 +609,7 @@ module ApplicationHelper
parsed << text
if tag
if closing
if tags.last.casecmp(tag) == 0
if tags.last && tags.last.casecmp(tag) == 0
tags.pop
end
else

+ 6
- 0
test/unit/helpers/application_helper_test.rb View File

@@ -994,6 +994,12 @@ EXPECTED
assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '')
end

def test_unbalanced_closing_pre_tag_should_not_error
assert_nothing_raised do
textilizable("unbalanced</pre>")
end
end

def test_syntax_highlight
raw = <<-RAW
<pre><code class="ruby">

Loading…
Cancel
Save