diff options
author | francis <francis> | 2008-10-28 17:58:47 +0000 |
---|---|---|
committer | francis <francis> | 2008-10-28 17:58:47 +0000 |
commit | fd61d6e1c05f60e472910a70dfe3ac103f99db97 (patch) | |
tree | 3a84bcb0de73708b8a347bce7558b61149519381 /app/controllers/request_controller.rb | |
parent | 378d4cee4e8bfb093d882c292ddd25511c23184a (diff) |
Cache HTML versions of attachments
Diffstat (limited to 'app/controllers/request_controller.rb')
-rw-r--r-- | app/controllers/request_controller.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index bb0d7f9bd..6b9ad780b 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: request_controller.rb,v 1.130 2008-10-27 18:18:30 francis Exp $ +# $Id: request_controller.rb,v 1.131 2008-10-28 17:58:48 francis Exp $ class RequestController < ApplicationController @@ -402,14 +402,11 @@ class RequestController < ApplicationController render :text => @attachment.body end + caches_page :get_attachment_as_html def get_attachment_as_html get_attachment_internal html = @attachment.body_as_html - # Mask any more emails that have now been exposed (e.g. in PDFs - ones in - # .doc will have been got in get_attachment_internal below) - html = @incoming_message.binary_mask_stuff(html) - view_html_stylesheet = render_to_string :partial => "request/view_html_stylesheet" html.sub!(/<head>/i, "<head>" + view_html_stylesheet) html.sub!(/<body[^>]*>/i, '<body><prefix-here><div id="wrapper"><div id="view_html_content">' + view_html_stylesheet) @@ -437,6 +434,10 @@ class RequestController < ApplicationController # Prevent spam to magic request address. # XXX Bit dodgy modifying a binary like this but hey. Maybe only do for some mime types? @attachment.body = @incoming_message.binary_mask_stuff(@attachment.body) + + @attachment_url = get_attachment_url(:id => @incoming_message.info_request_id, + :incoming_message_id => @incoming_message.id, :part => @part_number, + :file_name => @filename ) end # FOI officers can upload a response |