aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/request_controller.rb
diff options
context:
space:
mode:
authorMatthew Landauer <matthew@openaustralia.org>2013-01-31 13:23:19 +1100
committerMatthew Landauer <matthew@openaustralia.org>2013-01-31 13:23:53 +1100
commitea03685aa9d09d7cd29e0ef875d3afa7758b29ea (patch)
tree314620a0b88065e520858b5cf363775e07c164be /app/controllers/request_controller.rb
parent5acd5cced50f72d0e88a4524f5aef23525511554 (diff)
There's really no need to test the internals of Rails
Diffstat (limited to 'app/controllers/request_controller.rb')
-rw-r--r--app/controllers/request_controller.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index c18a97443..500738b91 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -709,9 +709,13 @@ class RequestController < ApplicationController
key_path = foi_fragment_cache_path(key)
if foi_fragment_cache_exists?(key_path)
logger.info("Reading cache for #{key_path}")
- raise PermissionDenied.new("Directory listing not allowed") if File.directory?(key_path)
- render :text => foi_fragment_cache_read(key_path),
- :content_type => (AlaveteliFileTypes.filename_to_mimetype(params[:file_name].join("/")) || 'application/octet-stream')
+
+ if File.directory?(key_path)
+ render :text => "Directory listing not allowed", :status => 403
+ else
+ render :text => foi_fragment_cache_read(key_path),
+ :content_type => (AlaveteliFileTypes.filename_to_mimetype(params[:file_name].join("/")) || 'application/octet-stream')
+ end
return
end