diff --git a/lib/redmine/wiki_formatting.rb b/lib/redmine/wiki_formatting.rb index 412d0f434..f4496d98f 100644 --- a/lib/redmine/wiki_formatting.rb +++ b/lib/redmine/wiki_formatting.rb @@ -184,6 +184,10 @@ module Redmine html.gsub!(%r{\battachment:(.*?)}) do "attachment:#{$2}" end + # restore hires images which are misrecognized as email address eg. [printscreen@2x.png] + html.gsub!(%r{(.*?)}) do + "#{$3}" + end html end end diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb index b90522d81..34e4fe119 100644 --- a/test/helpers/application_helper_test.rb +++ b/test/helpers/application_helper_test.rb @@ -699,13 +699,13 @@ RAW with_settings :text_formatting => 'textile' do raw = "attachment:image@2x.png should not be parsed in image@2x.png" - assert_match %r{
image@2x.png should not be parsed in image@2x.png
}, + assert_match %r{image@2x.png should not be parsed in image@2x.png
}, textilizable(raw, :attachments => [attachment]) end with_settings :text_formatting => 'markdown' do raw = "attachment:image@2x.png should not be parsed in image@2x.png" - assert_match %r{image@2x.png should not be parsed in image@2x.png
} , + assert_match %r{image@2x.png should not be parsed in image@2x.png
} , textilizable(raw, :attachments => [attachment]) end end diff --git a/test/unit/lib/redmine/wiki_formatting_test.rb b/test/unit/lib/redmine/wiki_formatting_test.rb index f6bf2d3f6..b460bad35 100644 --- a/test/unit/lib/redmine/wiki_formatting_test.rb +++ b/test/unit/lib/redmine/wiki_formatting_test.rb @@ -77,6 +77,18 @@ EXPECTED end end + def test_hires_images_should_not_be_recognized_as_email_addresses + raw = <<-DIFF +Image: logo@2x.png + DIFF + + expected = <<-EXPECTED +Image: logo@2x.png
+ EXPECTED + + assert_equal expected.gsub(%r{[\r\n\t]}, ''), Redmine::WikiFormatting::NullFormatter::Formatter.new(raw).to_html.gsub(%r{[\r\n\t]}, '') + end + def test_cache_key_for_saved_object_should_no_be_nil assert_not_nil Redmine::WikiFormatting.cache_key_for('textile', 'Text', Issue.find(1), :description) end