Commit 67f6ebd913c3b64ae82f47ce6835ab54f8291eaf

Authored by Rodrigo Souto
1 parent 4e97f113

content-viewer-controller: user_is_a_bot consider possible empty user_agent

app/controllers/public/content_viewer_controller.rb
... ... @@ -159,10 +159,12 @@ class ContentViewerController < ApplicationController
159 159 helper_method :pass_without_comment_captcha?
160 160  
161 161 def user_is_a_bot?
162   - request.env["HTTP_USER_AGENT"].match(/bot/) ||
163   - request.env["HTTP_USER_AGENT"].match(/spider/) ||
164   - request.env["HTTP_USER_AGENT"].match(/crawler/) ||
165   - request.env["HTTP_USER_AGENT"].match(/\(.*https?:\/\/.*\)/)
  162 + user_agent= request.env["HTTP_USER_AGENT"]
  163 + user_agent.blank? ||
  164 + user_agent.match(/bot/) ||
  165 + user_agent.match(/spider/) ||
  166 + user_agent.match(/crawler/) ||
  167 + user_agent.match(/\(.*https?:\/\/.*\)/)
166 168 end
167 169  
168 170 end
... ...