Skip to content

Commit

Permalink
fix images detection issues for file_upload types
Browse files Browse the repository at this point in the history
  • Loading branch information
Laith-jalal committed Jun 22, 2023
1 parent 647347c commit d209b87
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rails_admin/config/fields/types/file_upload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class FileUpload < RailsAdmin::Config::Fields::Base
end

register_instance_option :image? do
mime_type = Mime::Type.lookup_by_extension(resource_url.to_s.split('.').last)
mime_type = Mime::Type.lookup_by_extension(resource_url.to_s.split('.').last&.split('?')&.first)
mime_type.to_s.match?(/^image/)
end

Expand Down

0 comments on commit d209b87

Please sign in to comment.