diff options
author | Louise Crow <louise.crow@gmail.com> | 2014-12-22 10:55:30 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2014-12-22 11:04:00 +0000 |
commit | b2a1d7c2ea65c69bb01191ab1df09df004e67348 (patch) | |
tree | 52746697a9296a7788ded7bf35928e8f03990b7b /app/controllers/request_controller.rb | |
parent | 052c242d74b1aff44b5d08ed664201f17792e5a4 (diff) |
Sanitize the contents of HTML attachments before display
Diffstat (limited to 'app/controllers/request_controller.rb')
-rw-r--r-- | app/controllers/request_controller.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 9e2c291dc..a334abcb7 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -777,6 +777,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 |