aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/request_controller.rb
diff options
context:
space:
mode:
authorFrancis Irving <francis@mysociety.org>2010-05-18 10:54:50 +0100
committerFrancis Irving <francis@mysociety.org>2010-05-18 10:54:50 +0100
commitba0bf5c3feb038a3e93a46b3c6790d467d298357 (patch)
tree9dd8b3431576c2f7644470ef0144b6724307fd7b /app/controllers/request_controller.rb
parenta2b8a05d128efe5b4e86b7c9be79e3e313755372 (diff)
Generate path for fragment cache in central place
Diffstat (limited to 'app/controllers/request_controller.rb')
-rw-r--r--app/controllers/request_controller.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index eaed31213..cca96214b 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -546,8 +546,9 @@ class RequestController < ApplicationController
around_filter :cache_attachments, :only => [ :get_attachment, :get_attachment_as_html ]
def cache_attachments
key = params.merge(:only_path => true)
- if cached = read_fragment(key)
- #if cached = 'zzz***zzz'
+ key_path = foi_fragment_cache_path(key)
+
+ if cached = read_fragment(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)
@@ -556,7 +557,7 @@ class RequestController < ApplicationController
yield
- write_fragment(key, response.body)
+ write_fragment(key_path, response.body)
end
def get_attachment