diff options
Diffstat (limited to 'app/controllers/attachments_controller.rb')
-rw-r--r-- | app/controllers/attachments_controller.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 14025cb86..ea45397ef 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -59,7 +59,7 @@ class AttachmentsController < ApplicationController # images are sent inline send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename), :type => detect_content_type(@attachment), - :disposition => (@attachment.image? ? 'inline' : 'attachment') + :disposition => disposition(@attachment) end end @@ -191,4 +191,12 @@ class AttachmentsController < ApplicationController end content_type.to_s end + + def disposition(attachment) + if attachment.is_image? || attachment.is_pdf? + 'inline' + else + 'attachment' + end + end end |