summaryrefslogtreecommitdiffstats
path: root/app/controllers/attachments_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-05-09 17:22:23 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-05-09 17:22:23 +0000
commit3e776af8066e478beb5d2bc9bd26e81d2bef2542 (patch)
tree4aa73b256f1a451e1fc2de06512ca1f1fd9badc8 /app/controllers/attachments_controller.rb
parent3bdf6e995a35299c3e96cc7b0cbbd6a9baed0a98 (diff)
downloadredmine-3e776af8066e478beb5d2bc9bd26e81d2bef2542.tar.gz
redmine-3e776af8066e478beb5d2bc9bd26e81d2bef2542.zip
Don't force download of PDF (#22483).
Patch by Gregor Schmidt. git-svn-id: http://svn.redmine.org/redmine/trunk@15409 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/attachments_controller.rb')
-rw-r--r--app/controllers/attachments_controller.rb10
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