##// END OF EJS Templates
Fixed: Inline images don't work if file name has upper case letters or if image is in BMP format (#2102)....
Jean-Philippe Lang -
r1956:0f1787ea0dfa
parent child
Show More
@@ -247,7 +247,7 module ApplicationHelper
247 247
248 248 if attachments
249 249 attachments = attachments.sort_by(&:created_on).reverse
250 text = text.gsub(/!((\<|\=|\>)?(\([^\)]+\))?(\[[^\]]+\])?(\{[^\}]+\})?)(\S+\.(gif|jpg|jpeg|png))!/) do |m|
250 text = text.gsub(/!((\<|\=|\>)?(\([^\)]+\))?(\[[^\]]+\])?(\{[^\}]+\})?)(\S+\.(bmp|gif|jpg|jpeg|png))!/i) do |m|
251 251 style = $1
252 252 filename = $6
253 253 rf = Regexp.new(Regexp.escape(filename), Regexp::IGNORECASE)
@@ -24,7 +24,8 class ApplicationHelperTest < HelperTestCase
24 24 :repositories, :changesets,
25 25 :trackers, :issue_statuses, :issues, :versions, :documents,
26 26 :wikis, :wiki_pages, :wiki_contents,
27 :boards, :messages
27 :boards, :messages,
28 :attachments
28 29
29 30 def setup
30 31 super
@@ -70,6 +71,15 class ApplicationHelperTest < HelperTestCase
70 71 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
71 72 end
72 73
74 def test_attached_images
75 to_test = {
76 'Inline image: !logo.gif!' => 'Inline image: <img src="/attachments/download/3" title="This is a logo" alt="This is a logo" />',
77 'Inline image: !logo.GIF!' => 'Inline image: <img src="/attachments/download/3" title="This is a logo" alt="This is a logo" />'
78 }
79 attachments = Attachment.find(:all)
80 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text, :attachments => attachments) }
81 end
82
73 83 def test_textile_external_links
74 84 to_test = {
75 85 'This is a "link":http://foo.bar' => 'This is a <a href="http://foo.bar" class="external">link</a>',
General Comments 0
You need to be logged in to leave comments. Login now