Skip to content

Commit

Permalink
Merge 84ac15c into 3896f16
Browse files Browse the repository at this point in the history
  • Loading branch information
codealchemy committed Sep 22, 2021
2 parents 3896f16 + 84ac15c commit ebbf7ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/rails_admin/config/fields/types/active_storage.rb
Expand Up @@ -17,7 +17,8 @@ class ActiveStorage < RailsAdmin::Config::Fields::Types::FileUpload

register_instance_option :image? do
if value
value.filename.to_s.split('.').last =~ /jpg|jpeg|png|gif|svg/i
mime_type = Mime::Type.lookup_by_extension(value.filename.extension_without_delimiter)
mime_type.to_s.match?(/^image/)
end
end

Expand Down
Expand Up @@ -18,7 +18,8 @@ class ActiveStorageAttachment < RailsAdmin::Config::Fields::Types::MultipleFileU

register_instance_option :image? do
if value
value.filename.to_s.split('.').last =~ /jpg|jpeg|png|gif|svg/i
mime_type = Mime::Type.lookup_by_extension(value.filename.extension_without_delimiter)
mime_type.to_s.match?(/^image/)
end
end

Expand Down

0 comments on commit ebbf7ee

Please sign in to comment.