class
MartenRailsBridge::ActiveStorage::DiskHandler
- MartenRailsBridge::ActiveStorage::DiskHandler
- Marten::Handlers::Base
- Reference
- Object
Overview
Serves blobs stored with the Disk service, through an expiring signed key.
Mount it on the route Rails uses, so that URLs issued by a Rails app keep resolving (Rails
names this route rails_disk_service):
path "/rails/active_storage/disk/<encoded_key:str>/<filename:path>",
MartenRailsBridge::ActiveStorage::DiskHandler,
name: "active_storage_disk"
The filename route parameter only shapes the URL: the content type and the disposition
served to the client come from the encoded key.
https://github.com/rails/rails/blob/v8.1.3/activestorage/app/controllers/active_storage/disk_controller.rb
Defined in:
active_storage/disk_handler.crConstant Summary
-
CHUNK_SIZE =
8192 -
Size of the chunks the file is streamed in, matching
Rack::Files. -
DEFAULT_SEND_FILE_DISPOSITION =
"attachment" -
Disposition served when the encoded key carries none (
ActionController::DataStreaming::DEFAULT_SEND_FILE_DISPOSITION). -
DEFAULT_SEND_FILE_TYPE =
"application/octet-stream" -
Content type served when the encoded key carries none (
ActionController::DataStreaming::DEFAULT_SEND_FILE_TYPE). https://github.com/rails/rails/blob/v8.1.3/actionpack/lib/action_controller/metal/data_streaming.rb -
RANGE_NOT_SATISFIABLE_BODY =
"Byte range unsatisfiable\n" -
Body
Rack::Filesserves when aRangeheader cannot be satisfied.
Instance Method Summary
-
#get
Handles a
GETHTTP request and returns aMarten::HTTP::Responseobject.
Instance Method Detail
Handles a GET HTTP request and returns a Marten::HTTP::Response object.
The default implementation will return a 405 (not allowed) response.