diff options
author | José Valim <jose.valim@gmail.com> | 2010-10-04 18:06:04 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-10-04 18:06:04 +0200 |
commit | 0b51f3cc73ac21ed56b45a15fcce1d31beb7170c (patch) | |
tree | 973e384beeb2811a4eb970b8c3147a2bdacc1b28 /actionpack/lib/action_dispatch | |
parent | 10d014acb875c8201b33f5ffe7b08dbcd81b2875 (diff) | |
download | rails-0b51f3cc73ac21ed56b45a15fcce1d31beb7170c.tar.gz rails-0b51f3cc73ac21ed56b45a15fcce1d31beb7170c.tar.bz2 rails-0b51f3cc73ac21ed56b45a15fcce1d31beb7170c.zip |
Ensure the proper content type is returned for static files.
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/static.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/static.rb b/actionpack/lib/action_dispatch/middleware/static.rb index cf13938331..913b899e20 100644 --- a/actionpack/lib/action_dispatch/middleware/static.rb +++ b/actionpack/lib/action_dispatch/middleware/static.rb @@ -6,13 +6,13 @@ module ActionDispatch @at, @root = at.chomp('/'), root.chomp('/') @compiled_at = (Regexp.compile(/^#{Regexp.escape(at)}/) unless @at.blank?) @compiled_root = Regexp.compile(/^#{Regexp.escape(root)}/) - @file_server = ::Rack::File.new(root) + @file_server = ::Rack::File.new(@root) end def match?(path) path = path.dup - if @compiled_at.blank? || path.sub!(@compiled_at, '') - full_path = File.join(@root, ::Rack::Utils.unescape(path)) + if !@compiled_at || path.sub!(@compiled_at, '') + full_path = path.empty? ? @root : File.join(@root, ::Rack::Utils.unescape(path)) paths = "#{full_path}#{ext}" matches = Dir[paths] |