diff --git a/lib/redmine_comments/application_helper_patch.rb b/lib/redmine_comments/application_helper_patch.rb index ab1b280..d6f1832 100644 --- a/lib/redmine_comments/application_helper_patch.rb +++ b/lib/redmine_comments/application_helper_patch.rb @@ -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