Skip to content

Commit

Permalink
Update patched method according to changes in Redmine 5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nanego committed Jun 19, 2024
1 parent 507ab72 commit a8ca210
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/redmine_comments/application_helper_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ def parse_inline_attachments(text, project, obj, attr, only_path, options)
## END PATCH

if attachments.present?
text.gsub!(/src="([^\/"]+\.(bmp|gif|jpg|jpe|jpeg|png))"(\s+alt="([^"]*)")?/i) do |m|
text.gsub!(/src="([^\/"]+\.(bmp|gif|jpg|jpe|jpeg|png|webp))"(\s+alt="([^"]*)")?/i) do |m|
filename, ext, alt, alttext = $1, $2, $3, $4
# search for the picture in attachments
if found = Attachment.latest_attach(attachments, CGI.unescape(filename))
image_url = download_named_attachment_url(found, found.filename, :only_path => only_path)
desc = found.description.to_s.gsub('"', '')
desc = found.description.to_s.delete('"')
if !desc.blank? && alttext.blank?
alt = " title=\"#{desc}\" alt=\"#{desc}\""
end
"src=\"#{image_url}\"#{alt}"
"src=\"#{image_url}\"#{alt} loading=\"lazy\""
else
m
end
Expand Down

0 comments on commit a8ca210

Please sign in to comment.