Ensure correct extension when downloading documents

This commit is contained in:
Patrick Gansterer 2017-10-11 01:30:29 +02:00
parent 7d112516a1
commit 957b347b04
2 changed files with 16 additions and 5 deletions

View file

@ -54,10 +54,6 @@ class DocumentsController < ApplicationController
def show
@document = Document.find(params[:id])
filename = @document.name
unless filename.include? '.'
filename += '.' + MIME::Types[@document.mime].first.preferred_extension
end
send_data(@document.data, :filename => filename, :type => @document.mime)
send_data(@document.data, filename: @document.filename, type: @document.mime)
end
end