Handle invalid UTF-8 bytes in User-Agent (#351)
Alexander Fedulin
committed Apr 07, 2018
commit 30a612e788fc1981ae91cddb4d57bfb7ba5fb240
Showing 1
changed file with
1 additions
and 1 deletions
ahoy/visit_properties.rb b/lib/ahoy/visit_properties.rb
+1
-1
| @@ | @@ -72,7 +72,7 @@ module Ahoy |
| def request_properties | |
| { | |
| ip: request.remote_ip, | |
| - | user_agent: request.user_agent, |
| + | user_agent: request.user_agent.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: ''), |
| referrer: referrer, | |
| landing_page: landing_page, | |
| platform: params["platform"], | |