diff options
author | Robin Houston <robin@lenny.robin> | 2011-06-21 02:27:28 +0100 |
---|---|---|
committer | Robin Houston <robin@lenny.robin> | 2011-06-21 02:27:28 +0100 |
commit | 23a8c8fae9eb3e0892cdab5c6f3343bf06a5c6dc (patch) | |
tree | 012d5e686a3b6020487d384f38458ae6f9c5b111 /app/controllers/request_controller.rb | |
parent | 9d62991558aba1f0603a3107a8b2ca19010dbf56 (diff) |
- Refactor models/incoming_message.rb to get rid of the hideous
global variables and methods. Move the MIME type stuff into
lib/alaveteli_file_types.rb.
- Correct the spelling of the word extensions (not extentions).
Diffstat (limited to 'app/controllers/request_controller.rb')
-rw-r--r-- | app/controllers/request_controller.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 024f87dd5..9c0855b8d 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -6,6 +6,8 @@ # # $Id: request_controller.rb,v 1.192 2009-10-19 19:26:40 francis Exp $ +require 'alaveteli_file_types' + class RequestController < ApplicationController before_filter :check_read_only, :only => [ :new, :show_response, :describe_state, :upload_response ] protect_from_forgery :only => [ :new, :show_response, :describe_state, :upload_response ] # See ActionController::RequestForgeryProtection for details @@ -585,8 +587,7 @@ class RequestController < ApplicationController 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' + response.content_type = AlaveteliFileTypes.filename_to_mimetype(params[:file_name].join("/")) or 'application/octet-stream' render_for_text(cached) return end @@ -608,7 +609,7 @@ class RequestController < ApplicationController @incoming_message.binary_mask_stuff!(@attachment.body, @attachment.content_type) # we don't use @attachment.content_type here, as we want same mime type when cached in cache_attachments above - response.content_type = filename_to_mimetype(params[:file_name].join("/")) or 'application/octet-stream' + response.content_type = AlaveteliFileTypes.filename_to_mimetype(params[:file_name].join("/")) or 'application/octet-stream' render :text => @attachment.body end |