jeygeethan / activestorage-backblaze

Looking for co-committers. Pls reach out. Activestorage (rails 6) gem for using backblaze b2 as the storage (just like aws s3 etc)
26 stars 10 forks source link

Missing the content-type when put object #2

Closed gagoit closed 4 years ago

gagoit commented 4 years ago

When put_object, we missed the options that has the content_type of file. https://github.com/jeygeethan/activestorage-backblaze/blob/master/lib/active_storage/service/backblaze_service.rb#L19-L31

  def upload(key, io, checksum: nil, **options)
    instrument :upload, { key: key, checksum: checksum } do
      begin
        io.binmode
        io.rewind
        @connection.put_object(@bucket_name, key, io.read)
      rescue => e
        puts "ERROR - 101"
        puts e.inspect
        raise ActiveStorage::IntegrityError
      end
    end
  end

It should be

@connection.put_object(@bucket_name, key, io.read, options)
jeygeethan commented 4 years ago

Closing this, since merged.