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 16:33:13 +0000 |
commit | 55f7ac2004f53ebc48efb90c45f64563a7cd660d (patch) | |
tree | 8a5e71cc0a4c03b4e9cf103a1fea688f07054860 /app/controllers/request_controller.rb | |
parent | b6cd9b05ae27370088c04973413730040f4ff08c (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 d66c28275..3f41be594 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -744,6 +744,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 |