Class: Maglev::ActiveStorage::ServingBlob

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/maglev/active_storage/serving_blob.rb

Overview

Since assets are uploaed by editors, we can assume they are always safe to serve. Wraps ActiveStorage::Blob only for Maglev’s proxy: Active Storage maps image/svg+xml to application/octet-stream globally; we serve SVG as image/svg+xml without changing the host app’s config.

Instance Method Summary collapse

Instance Method Details

#content_type_for_servingObject



9
10
11
12
13
# File 'lib/maglev/active_storage/serving_blob.rb', line 9

def content_type_for_serving
  return 'image/svg+xml' if svg?

  __getobj__.content_type_for_serving
end

#forced_disposition_for_servingObject



15
16
17
18
19
# File 'lib/maglev/active_storage/serving_blob.rb', line 15

def forced_disposition_for_serving
  return nil if svg?

  __getobj__.forced_disposition_for_serving
end