Permalink
Browse files

rescue Errno::ENOENT.

  • Loading branch information...
1 parent 54cbf83 commit 8dae9710cc89c100774d5f5da260074f99c9b8b8 shugo committed Feb 18, 2006
Showing with 16 additions and 13 deletions.
  1. +16 −13 lib/apache/rails-dispatcher.rb
@@ -71,21 +71,24 @@ def translate_uri(r)
nil, "n")
filename = File.expand_path(r.uri.sub(re, "public/"),
r.options["rails_root"])
- 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
+ begin
+ 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
+ rescue Errno::ENOENT
end
return DECLINED
end

0 comments on commit 8dae971

Please sign in to comment.