From ba0bf5c3feb038a3e93a46b3c6790d467d298357 Mon Sep 17 00:00:00 2001 From: Francis Irving Date: Tue, 18 May 2010 10:54:50 +0100 Subject: Generate path for fragment cache in central place --- app/controllers/request_controller.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'app/controllers/request_controller.rb') 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 -- cgit v1.2.3