aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/request_controller.rb7
-rw-r--r--app/models/incoming_message.rb9
-rw-r--r--todo.txt1
3 files changed, 10 insertions, 7 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 6b9ad780b..c71c2f804 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.131 2008-10-28 17:58:48 francis Exp $
+# $Id: request_controller.rb,v 1.132 2008-10-28 18:23:31 francis Exp $
class RequestController < ApplicationController
@@ -405,7 +405,10 @@ class RequestController < ApplicationController
caches_page :get_attachment_as_html
def get_attachment_as_html
get_attachment_internal
- html = @attachment.body_as_html
+
+ image_dir = File.dirname(Rails.public_path + url_for(params.merge(:only_path => true)))
+ FileUtils.mkdir_p(image_dir)
+ html = @attachment.body_as_html(image_dir)
view_html_stylesheet = render_to_string :partial => "request/view_html_stylesheet"
html.sub!(/<head>/i, "<head>" + view_html_stylesheet)
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index ff2df09a3..a9434e233 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -19,7 +19,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: incoming_message.rb,v 1.159 2008-10-28 14:56:56 francis Exp $
+# $Id: incoming_message.rb,v 1.160 2008-10-28 18:23:31 francis Exp $
# TODO
# Move some of the (e.g. quoting) functions here into rblib, as they feel
@@ -162,9 +162,9 @@ class FOIAttachment
end
end
- def body_as_html
- tempfile = Tempfile.new('foiextract')
- tempfile.print body
+ def body_as_html(dir)
+ tempfile = Tempfile.new('foiextract', dir)
+ tempfile.print self.body
tempfile.flush
if content_type == 'application/vnd.ms-word'
@@ -181,6 +181,7 @@ class FOIAttachment
end
tempfile.close
+ tempfile.delete
return html
end
diff --git a/todo.txt b/todo.txt
index d0241b509..55b9f1bde 100644
--- a/todo.txt
+++ b/todo.txt
@@ -52,7 +52,6 @@ Knackered view as HTML:
http://www.whatdotheyknow.com/request/statistics_for_allocation_of_dut#incoming-4793
http://www.whatdotheyknow.com/request/post_lawrence_report_diversity_t_7#incoming-5483
http://www.whatdotheyknow.com/request/3289/response/7810/attach/html/3/20081023ReplyLetter.pdf
-Make it show images properly
Performance:
Remove loading of public body tags from every info request load