Project

General

Profile

Defect #10189 » images_with_space.patch

Please test and feedback. No changes to Redmine syntax - Paulo Neves, 2013-12-15 14:12

View differences:

app/helpers/application_helper.rb 2013-12-15 11:45:55.960476540 +0000 → helpers/application_helper.rb 2013-12-15 12:49:41.032533340 +0000
m
end
end
text.gsub!(/!([^(!]+?)(\.bmp|gif|jpg|jpe|jpeg|png)\s?(?:\(((?:[^\(\)]|\([^\)]+\))+?)\))?\!/i) do |m|
filename= $1.downcase+$2
alt = "alt=\"#{$3}\""
# search for the picture in attachments
if found = Attachment.latest_attach(attachments, filename)
image_url = download_named_attachment_path(found, found.filename, :only_path => only_path)
desc = found.description.to_s.gsub('"', '')
if !desc.blank?
alt = " title=\"#{desc}\" alt=\"#{desc}\""
end
"<img src=\"#{image_url}\"#{alt} />"
else
m
end
end
#One last effort to catch an attached image
end
end
(5-5/5)