Sha256: fe99be3c425ce4d3a417c1461873689d09aad7b366f13fe1ab82925c7d2b7fc2
Contents?: true
Size: 925 Bytes
Versions: 5
Compression:
Stored size: 925 Bytes
Contents
# frozen_string_literal: true # Proxy files through application. This avoids having a redirect and makes files easier to cache. # # WARNING: All Active Storage controllers are publicly accessible by default. The # generated URLs are hard to guess, but permanent by design. If your files # require a higher level of protection consider implementing # {Authenticated Controllers}[https://edgeguides.rubyonrails.org/active_storage_overview.html#authenticated-controllers]. class ActiveStorage::Blobs::ProxyController < ActiveStorage::BaseController include ActiveStorage::SetBlob def show if request.headers["Range"].present? send_blob_byte_range_data @blob, request.headers["Range"] else http_cache_forever public: true do response.headers["Accept-Ranges"] = "bytes" response.headers["Content-Length"] = @blob.byte_size.to_s send_blob_stream @blob end end end end
Version data entries
5 entries across 5 versions & 1 rubygems