summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2023-01-16 01:23:36 +0000
committerGo MAEDA <maeda@farend.jp>2023-01-16 01:23:36 +0000
commit91705e083beeece533afcad8b7285f6698c2a6da (patch)
treeb50243551846b55f68c08a15a636164e5c9aec11 /app
parent33088ed3c20bfa8c1d45fbdc9f17b0e2ea69a578 (diff)
downloadredmine-91705e083beeece533afcad8b7285f6698c2a6da.tar.gz
redmine-91705e083beeece533afcad8b7285f6698c2a6da.zip
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
Diffstat (limited to 'app')
-rw-r--r--app/helpers/application_helper.rb2
-rw-r--r--app/models/attachment.rb2
2 files changed, 2 insertions, 2 deletions
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?