Project

General

Profile

Defect #3480 » bot_filter.patch

Test for nil useragent - Brad Schick, 2009-06-11 08:50

View differences:

lib\bots_filter_new.rb Wed Jun 10 23:43:27 2009
30 30
  BOTS_USER_AGENT_RE = Regexp.new("(#{BOTS_USER_AGENT.collect {|a| Regexp.escape(a)}.join('|')})", Regexp::IGNORECASE)
31 31
  
32 32
  def bot_request?
33
    request.user_agent.match(BOTS_USER_AGENT_RE)
33
    if request.user_agent.nil?
34
        return true
35
    end
36
    return request.user_agent.match(BOTS_USER_AGENT_RE)
34 37
  end
35 38
end
36 39

  
(1-1/2)