summaryrefslogtreecommitdiff
path: root/lib/rack/static.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rack/static.rb')
-rw-r--r--lib/rack/static.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/rack/static.rb b/lib/rack/static.rb
index 168e8f83..e8c93373 100644
--- a/lib/rack/static.rb
+++ b/lib/rack/static.rb
@@ -25,14 +25,21 @@ module Rack
def call(env)
path = env["PATH_INFO"]
- can_serve = @urls.any? { |url| path.index(url) == 0 }
-
+
+ unless @urls.kind_of? Hash
+ can_serve = @urls.any? { |url| path.index(url) == 0 }
+ else
+ can_serve = @urls.key? path
+ end
+
if can_serve
+ env["PATH_INFO"] = @urls[path] if @urls.kind_of? Hash
@file_server.call(env)
else
@app.call(env)
end
end
+
end
end