From c692774bbae528d83925d04e1c3cebb73e3f8ae5 Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Fri, 11 Jan 2013 16:48:58 -0500 Subject: [PATCH] Fix regression introduced in pull request 8812 See https://github.com/rails/rails/pull/8812#commitcomment-2416514 --- actionpack/lib/action_dispatch/middleware/static.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/actionpack/lib/action_dispatch/middleware/static.rb b/actionpack/lib/action_dispatch/middleware/static.rb index 1c9512ad01825..c6a7d9c415be1 100644 --- a/actionpack/lib/action_dispatch/middleware/static.rb +++ b/actionpack/lib/action_dispatch/middleware/static.rb @@ -6,7 +6,8 @@ class FileHandler def initialize(root, cache_control) @root = root.chomp('/') @compiled_root = /^#{Regexp.escape(root)}/ - @file_server = ::Rack::File.new(@root, 'Cache-Control' => cache_control) + headers = cache_control && { 'Cache-Control' => cache_control } + @file_server = ::Rack::File.new(@root, headers) end def match?(path)