app/controllers/alchemy/attachments_controller.rb in alchemy_cms-3.5.0 vs app/controllers/alchemy/attachments_controller.rb in alchemy_cms-3.6.0
- old
+ new
@@ -3,10 +3,11 @@
before_action :load_attachment
authorize_resource class: Alchemy::Attachment
# sends file inline. i.e. for viewing pdfs/movies in browser
def show
+ response.headers['Content-Length'] = @attachment.file.size.to_s
send_file(
@attachment.file.path,
{
filename: @attachment.file_name,
type: @attachment.file_mime_type,
@@ -15,9 +16,10 @@
)
end
# sends file as attachment. aka download
def download
+ response.headers['Content-Length'] = @attachment.file.size.to_s
send_file(
@attachment.file.path, {
filename: @attachment.file_name,
type: @attachment.file_mime_type
}