mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 19:57:52 +01:00
14 lines
507 B
Ruby
14 lines
507 B
Ruby
class LocalFilesController < ApplicationController
|
|
def show
|
|
blob = ActiveStorage::Blob.find_by(key: params[:key])
|
|
|
|
if blob.present? && blob.service.is_a?(ActiveStorage::Service::DiskService)
|
|
send_file blob.service.path_for(blob.key),
|
|
type: blob.content_type, # Set correct MIME type
|
|
disposition: :inline, # Show in browser
|
|
filename: blob.filename.to_s # Ensure correct filename
|
|
else
|
|
head :not_found
|
|
end
|
|
end
|
|
end |