Sha256: 2590227c9e33fb1794f746fbd58331906252db9361b93ef2d8492df59ab8d563

Contents?: true

Size: 563 Bytes

Versions: 8

Compression:

Stored size: 563 Bytes

Contents

# frozen_string_literal: true

module Shimmer
  class FilesController < ActionController::Base
    def show
      expires_in 1.year, public: true
      request.session_options[:skip] = true # prevents a session cookie from being set (would prevent caching on CDNs)
      proxy = FileProxy.restore(params.require(:id))
      send_data proxy.file,
        filename: proxy.filename.to_s,
        type: proxy.content_type,
        disposition: "inline"
    rescue ActiveRecord::RecordNotFound, ActiveStorage::FileNotFoundError
      head :not_found
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
shimmer-0.0.41 lib/shimmer/controllers/files_controller.rb
shimmer-0.0.40 lib/shimmer/controllers/files_controller.rb
shimmer-0.0.39 lib/shimmer/controllers/files_controller.rb
shimmer-0.0.38 lib/shimmer/controllers/files_controller.rb
shimmer-0.0.37 lib/shimmer/controllers/files_controller.rb
shimmer-0.0.36 lib/shimmer/controllers/files_controller.rb
shimmer-0.0.35 lib/shimmer/controllers/files_controller.rb
shimmer-0.0.34 lib/shimmer/controllers/files_controller.rb