aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/request_controller.rb
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2012-02-15 09:45:20 +0000
committerSeb Bacon <seb.bacon@gmail.com>2012-02-15 09:45:20 +0000
commit506af7a640f63b17000ccfc5e1344bbc3039c913 (patch)
treea3091a30d7b905936b346197b8f5fce7fc3a8b95 /app/controllers/request_controller.rb
parentbd1dbfb1db2527e9977899f3be69e624c42249fb (diff)
Set a "Content-Disposition: attachment" header when downloading files. Closes #428
Diffstat (limited to 'app/controllers/request_controller.rb')
-rw-r--r--app/controllers/request_controller.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index ef958ae9d..b484ec514 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
# app/controllers/request_controller.rb:
# Show information about one particular request.
#
@@ -684,7 +685,7 @@ class RequestController < ApplicationController
# we don't use @attachment.content_type here, as we want same mime type when cached in cache_attachments above
response.content_type = AlaveteliFileTypes.filename_to_mimetype(params[:file_name].join("/")) || 'application/octet-stream'
-
+ headers["Content-Disposition"] = "attachment; filename=#{params[:file_name]}"
render :text => @attachment.body
end