diff options
author | Francis Irving <francis@mysociety.org> | 2010-09-06 09:59:24 +0100 |
---|---|---|
committer | Francis Irving <francis@mysociety.org> | 2010-09-06 09:59:24 +0100 |
commit | 8912d36b02a44ac07e9a83214d4486159cc95863 (patch) | |
tree | a935a945d28feb90704bbd980f485c6ae143c675 /app/controllers/request_controller.rb | |
parent | 539e3d0f3cdf2aee836ea7b784e91d4ad1a9fbf1 (diff) |
Change the foi_cache to be explicit everywhere, so Interlock can use the
rails cache
Diffstat (limited to 'app/controllers/request_controller.rb')
-rw-r--r-- | app/controllers/request_controller.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 4588ef369..007cef5d1 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -563,8 +563,8 @@ class RequestController < ApplicationController key = params.merge(:only_path => true) key_path = foi_fragment_cache_path(key) - if File.exists?(key_path) - cached = File.read(key_path) + if foi_fragment_cache_exists?(key_path) + cached = foi_fragment_cache_read(key_path) IncomingMessage # load global filename_to_mimetype XXX should move filename_to_mimetype to proper namespace response.content_type = filename_to_mimetype(params[:file_name].join("/")) or 'application/octet-stream' render_for_text(cached) @@ -577,10 +577,7 @@ class RequestController < ApplicationController # various fragment cache functions using Ruby Marshall to write the file # which adds a header, so isnt compatible with images that have been # extracted elsewhere from PDFs) - FileUtils.mkdir_p(File.dirname(key_path)) - File.atomic_write(key_path) do |f| - f.write(response.body) - end + foi_fragment_cache_write(key_path, response.body) end def get_attachment |