aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/request_controller.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2014-12-22 10:55:30 +0000
committerLouise Crow <louise.crow@gmail.com>2014-12-22 16:07:45 +0000
commit5927555c42bfb4a1d091dfce8ba418a2d134c2b3 (patch)
treea88c5228b454d3e805bfbd83d5ce6ea075b746bc /app/controllers/request_controller.rb
parenta5cce7126bf2bbbfba784ea4954d16a964c88214 (diff)
Sanitize the contents of HTML attachments before display
Diffstat (limited to 'app/controllers/request_controller.rb')
-rw-r--r--app/controllers/request_controller.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index c4795ebe2..02f216340 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -768,6 +768,10 @@ 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]) || 'application/octet-stream'
+ if response.content_type == 'text/html'
+ @attachment.body = ActionController::Base.helpers.sanitize(@attachment.body)
+ end
+
render :text => @attachment.body
end