Permalink
Browse files

check index.{html,htm} in translate_uri.

  • Loading branch information...
shugo
shugo committed Feb 18, 2006
1 parent 4dd6313 commit 54cbf8359f6484d741a8969d0ed54bc136327de3
Showing with 13 additions and 1 deletion.
  1. +13 −1 lib/apache/rails-dispatcher.rb
@@ -71,10 +71,22 @@ def translate_uri(r)
nil, "n")
filename = File.expand_path(r.uri.sub(re, "public/"),
r.options["rails_root"])
- if File.file?(filename)
+ stat = File.stat(filename)
+ if stat.file?
r.filename = filename
return OK
end
+ if stat.directory?
+ file = ["index.html", "index.htm"].collect { |f|
+ File.expand_path(f, filename)
+ }.detect { |f|
+ File.file?(f)
+ }
+ if file
+ r.filename = file
+ return OK
+ end
+ end
return DECLINED
end

0 comments on commit 54cbf83

Please sign in to comment.