Sha256: 754341ea063902b79c7a2a2418d80fe7a0ce380ff4eb832a4a6d0046676f43b5
Contents?: true
Size: 901 Bytes
Versions: 1
Compression:
Stored size: 901 Bytes
Contents
# frozen_string_literal: true class AttachmentsController < ApplicationController include PagesCore::RangedResponse before_action :verify_signed_params before_action :find_attachment, only: %i[show download] static_cache :show, permanent: true def show send_attachment end def download send_attachment disposition: "attachment" end private def find_attachment @attachment = Attachment.find(params[:id]) end def send_attachment(disposition: "inline") unless stale?(etag: @attachment, last_modified: @attachment.updated_at) return end send_ranged_data(@attachment.data, filename: @attachment.filename, type: @attachment.content_type, disposition:) end def verify_signed_params key = params[:id].to_i.to_s Attachment.verifier.verify(key, params[:digest]) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pages_core-3.15.5 | app/controllers/attachments_controller.rb |