aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/middleware/static.rb
diff options
context:
space:
mode:
authorRajinder Yadav <devguy.ca@gmail.com>2010-10-15 22:19:39 -0400
committerRajinder Yadav <devguy.ca@gmail.com>2010-10-15 22:19:39 -0400
commit62eb00a62e3868c3500372def52968b919332b51 (patch)
tree8497f517402c19eae1fea22943565cbf11496ef7 /actionpack/lib/action_dispatch/middleware/static.rb
parent018bf0f5756ef3887815ea46d6671dc1d3b526cf (diff)
parentcffae06a4f1b7aac86a7e99cfb244890f837f976 (diff)
downloadrails-62eb00a62e3868c3500372def52968b919332b51.tar.gz
rails-62eb00a62e3868c3500372def52968b919332b51.tar.bz2
rails-62eb00a62e3868c3500372def52968b919332b51.zip
Merge branch 'master' of git://github.com/lifo/docrails
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware/static.rb')
-rw-r--r--actionpack/lib/action_dispatch/middleware/static.rb6
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]