mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:31:35 +08:00
DEV: allow handling crawler reqs with no user agent
Followup to e440ec25 we treat no user agent as crawler reqs.
This commit is contained in:
@ -118,7 +118,7 @@ class Middleware::RequestTracker
|
||||
|
||||
if h[:is_crawler]
|
||||
user_agent = env['HTTP_USER_AGENT']
|
||||
if user_agent.encoding != Encoding::UTF_8
|
||||
if user_agent && (user_agent.encoding != Encoding::UTF_8)
|
||||
user_agent = user_agent.encode("utf-8")
|
||||
user_agent.scrub!
|
||||
end
|
||||
|
Reference in New Issue
Block a user