mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 02:19:27 +08:00
DEV: Provide a safe agent in check_crawler_limits()
This commit is contained in:
parent
30ae313dec
commit
29460e1422
|
@ -460,7 +460,7 @@ class Middleware::RequestTracker
|
|||
slow_down_agents = SiteSetting.slow_down_crawler_user_agents
|
||||
return if slow_down_agents.blank?
|
||||
|
||||
user_agent = env["HTTP_USER_AGENT"]&.downcase
|
||||
user_agent = HttpUserAgentEncoder.ensure_utf8(env["HTTP_USER_AGENT"])&.downcase
|
||||
return if user_agent.blank?
|
||||
|
||||
return if !CrawlerDetection.crawler?(user_agent)
|
||||
|
|
Loading…
Reference in New Issue
Block a user