Permalink
Browse files

Added bot names escaping

  • Loading branch information...
1 parent 6ad37e9 commit 485f945da6c7a66fffd4b29296f00acbbc1ef16c @dimko dimko committed Feb 15, 2013
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/split/configuration.rb
@@ -138,7 +138,7 @@ def normalize_alternatives(alternatives)
end
def initialize
- @robot_regex = /\b(#{BOTS.keys.join('|')})\b|\A\W*\z/i
+ @robot_regex = /\b(?:#{escaped_bots.join('|')})\b|\A\W*\z/i
@ignore_ip_addresses = []
@db_failover = false
@db_failover_on_db_error = proc{|error|} # e.g. use Rails logger here
@@ -157,5 +157,9 @@ def value_for(hash, key)
hash[key.to_s] || hash[key.to_sym]
end
end
+
+ def escaped_bots
+ BOTS.map { |key, _| Regexp.escape(key) }
+ end
end
end

0 comments on commit 485f945

Please sign in to comment.