Skip to content
Browse files

Merge pull request #132 from dimko/patch-3

Fixed robot regexp escaping
  • Loading branch information...
2 parents f5437e9 + 485f945 commit 538d14e5e576b0479d9be16258a1de8fc5f03883 @andrew andrew committed
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/split/configuration.rb
View
6 lib/split/configuration.rb
@@ -138,7 +138,7 @@ def normalize_alternatives(alternatives)
end
def initialize
- @robot_regex = /\b(#{BOTS.keys.join('|')})\b|^\W*$/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 538d14e

Please sign in to comment.
Something went wrong with that request. Please try again.