From fd8e093ee8aeb5ad92198be51178492c088ff506 Mon Sep 17 00:00:00 2001 From: Henare Degan Date: Sat, 10 Aug 2013 15:29:15 +0300 Subject: Don't show diagnostic messages when request is simply local This fixes the scenario when Alaveteli is behind a proxy in production Resolves #1039 --- app/controllers/application_controller.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'app/controllers/application_controller.rb') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 88b107861..2cbb826af 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -119,12 +119,9 @@ class ApplicationController < ActionController::Base end def render_exception(exception) - - # In development, or the admin interface, or for a local request, let Rails handle the exception - # with its stack trace templates. Local requests in testing are a special case so that we can - # test this method - there we use consider_all_requests_local to control behaviour. - if Rails.application.config.consider_all_requests_local || local_request? || - (request.local? && !Rails.env.test?) + # In development or the admin interface let Rails handle the exception + # with its stack trace templates + if Rails.application.config.consider_all_requests_local || local_request? raise exception end -- cgit v1.2.3 From e7bdf54de3a94986c35204ad28e2cbd0a4e98c46 Mon Sep 17 00:00:00 2001 From: Henare Degan Date: Sat, 10 Aug 2013 15:35:44 +0300 Subject: Make method name clearer --- app/controllers/application_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/controllers/application_controller.rb') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2cbb826af..2ce44011f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -121,7 +121,7 @@ class ApplicationController < ActionController::Base def render_exception(exception) # In development or the admin interface let Rails handle the exception # with its stack trace templates - if Rails.application.config.consider_all_requests_local || local_request? + if Rails.application.config.consider_all_requests_local || show_rails_exceptions? raise exception end @@ -147,7 +147,7 @@ class ApplicationController < ActionController::Base end end - def local_request? + def show_rails_exceptions? false end -- cgit v1.2.3 From d3df251a8033b92ad89725a2a3fea91acdd7843d Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Thu, 22 Aug 2013 16:23:59 +0100 Subject: Move some download methods to InfoRequest. Use send_file to send zips. Also adds 'all_can_view_all_correspondence?' - is this request completely cachable, or do we need to cache different versions for different levels of privilege? --- app/controllers/application_controller.rb | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'app/controllers/application_controller.rb') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 88b107861..902b43215 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -214,19 +214,6 @@ class ApplicationController < ActionController::Base end end - def request_dirs(info_request) - first_three_digits = info_request.id.to_s()[0..2] - File.join(first_three_digits.to_s, info_request.id.to_s) - end - - def request_download_zip_dir(info_request) - File.join(download_zip_dir, "download", request_dirs(info_request)) - end - - def download_zip_dir() - File.join(Rails.root, '/cache/zips/') - end - # get the local locale def locale_from_params(*args) if params[:show_locale] -- cgit v1.2.3