Ensure correct extension when downloading documents
This commit is contained in:
parent
7d112516a1
commit
957b347b04
2 changed files with 16 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue