From 91705e083beeece533afcad8b7285f6698c2a6da Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Mon, 16 Jan 2023 01:23:36 +0000 Subject: Support for WebP images (#38168). * Inline image * Thumbnail * Inserting markup for an image uploaded by drag and drop Patch by Go MAEDA. git-svn-id: https://svn.redmine.org/redmine/trunk@22045 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 2 +- app/models/attachment.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index fac31d569..72d9d8efd 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -944,7 +944,7 @@ module ApplicationHelper attachments += obj.attachments if obj.respond_to?(:attachments) end 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)) diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 980890643..86382054d 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -220,7 +220,7 @@ class Attachment < ActiveRecord::Base end def image? - !!(self.filename =~ /\.(bmp|gif|jpg|jpe|jpeg|png)$/i) + !!(self.filename =~ /\.(bmp|gif|jpg|jpe|jpeg|png|webp)$/i) end def thumbnailable? -- cgit v1.2.3