Patch #16781 » fix_link_callback_exception.diff
| lib/redmine/wiki_formatting/markdown/formatter.rb | ||
|---|---|---|
| 28 | 28 |
unless link && link.starts_with?('/')
|
| 29 | 29 |
css = 'external' |
| 30 | 30 |
end |
| 31 |
content_tag('a', content.html_safe, :href => link, :title => title, :class => css)
|
|
| 31 |
content_tag('a', content.to_s.html_safe, :href => link, :title => title, :class => css)
|
|
| 32 | 32 |
end |
| 33 | 33 | |
| 34 | 34 |
def block_code(code, language) |
| test/unit/lib/redmine/wiki_formatting/markdown_formatter.rb | ||
|---|---|---|
| 24 | 24 |
@formatter = Redmine::WikiFormatting::Markdown::Formatter |
| 25 | 25 |
end |
| 26 | 26 | |
| 27 |
def test_syntax_error_in_image_reference_should_not_raise_exception |
|
| 28 |
assert @formatter.new("!>[](foo.png)").to_html
|
|
| 29 |
end |
|
| 30 | ||
| 31 |
# re-using the formatter after getting above error crashes the |
|
| 32 |
# ruby interpreter. This seems to be related to |
|
| 33 |
# https://github.com/vmg/redcarpet/issues/318 |
|
| 34 |
def test_should_not_crash_redcarpet_after_syntax_error |
|
| 35 |
@formatter.new("!>[](foo.png)").to_html rescue nil
|
|
| 36 |
assert @formatter.new("").to_html.present?
|
|
| 37 |
end |
|
| 38 | ||
| 27 | 39 |
def test_inline_style |
| 28 | 40 |
assert_equal "<p><strong>foo</strong></p>", @formatter.new("**foo**").to_html.strip
|
| 29 | 41 |
end |