diff options
Diffstat (limited to 'activestorage/app/models/active_storage/identification.rb')
-rw-r--r-- | activestorage/app/models/active_storage/identification.rb | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/activestorage/app/models/active_storage/identification.rb b/activestorage/app/models/active_storage/identification.rb index bf1d8f5624..8d334ae1ea 100644 --- a/activestorage/app/models/active_storage/identification.rb +++ b/activestorage/app/models/active_storage/identification.rb @@ -2,26 +2,21 @@ require "net/http" -class ActiveStorage::Identification +class ActiveStorage::Identification #:nodoc: attr_reader :blob def initialize(blob) @blob = blob end - def apply - blob.update!(content_type: content_type, identified: true) unless blob.identified? + def content_type + Marcel::MimeType.for(identifiable_chunk, name: filename, declared_type: declared_content_type) end private - def content_type - Marcel::MimeType.for(identifiable_chunk, name: filename, declared_type: declared_content_type) - end - - def identifiable_chunk Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") do |client| - client.get(uri, "Range" => "0-4096").body + client.get(uri, "Range" => "bytes=0-4095").body end end |