class StaticController

Public Instance Methods

get() click to toggle source
# File lib/egalite.rb, line 782
def get
  raise SecurityError unless env.opts[:static_root]
  
  path = req.path_info
  path.gsub!(/[^0-9a-zA-Z\(\)\. \/_\-]/,'')
  if path.include?("..") or path =~ /^\//
    return [403, {"Content-Type" => "text/plain"}, ["Forbidden\n"]]
  end
  path = File.join(env.opts[:static_root], path)
  send_file(path)
end