aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/middleware/static.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-10-06 12:11:38 +0100
committerJon Leighton <j@jonathanleighton.com>2010-10-06 12:11:38 +0100
commitc954d54e2f36bb53ced5e3655adc071dd233797e (patch)
treed84bf4bf51f65a1c817089c6fe37c3e9f20420d0 /actionpack/lib/action_dispatch/middleware/static.rb
parentf2b41914d6be935182d37e0c0d491352ac3de043 (diff)
parentd40ca9cce241a8083756c993d6c99a79e62e050e (diff)
downloadrails-c954d54e2f36bb53ced5e3655adc071dd233797e.tar.gz
rails-c954d54e2f36bb53ced5e3655adc071dd233797e.tar.bz2
rails-c954d54e2f36bb53ced5e3655adc071dd233797e.zip
Merge branch 'master' into nested_has_many_through
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]