diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index aad2c5bec..556b9551f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -247,7 +247,7 @@ module ApplicationHelper if attachments attachments = attachments.sort_by(&:created_on).reverse - text = text.gsub(/!((\<|\=|\>)?(\([^\)]+\))?(\[[^\]]+\])?(\{[^\}]+\})?)(\S+\.(gif|jpg|jpeg|png))!/) do |m| + text = text.gsub(/!((\<|\=|\>)?(\([^\)]+\))?(\[[^\]]+\])?(\{[^\}]+\})?)(\S+\.(bmp|gif|jpg|jpeg|png))!/i) do |m| style = $1 filename = $6 rf = Regexp.new(Regexp.escape(filename), Regexp::IGNORECASE) diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 6e1356bee..cbf5a54bc 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -24,7 +24,8 @@ class ApplicationHelperTest < HelperTestCase :repositories, :changesets, :trackers, :issue_statuses, :issues, :versions, :documents, :wikis, :wiki_pages, :wiki_contents, - :boards, :messages + :boards, :messages, + :attachments def setup super @@ -70,6 +71,15 @@ class ApplicationHelperTest < HelperTestCase to_test.each { |text, result| assert_equal "

#{result}

", textilizable(text) } end + def test_attached_images + to_test = { + 'Inline image: !logo.gif!' => 'Inline image: This is a logo', + 'Inline image: !logo.GIF!' => 'Inline image: This is a logo' + } + attachments = Attachment.find(:all) + to_test.each { |text, result| assert_equal "

#{result}

", textilizable(text, :attachments => attachments) } + end + def test_textile_external_links to_test = { 'This is a "link":http://foo.bar' => 'This is a link',