Permalink
Browse files

add .try() when force_encoding on user-agent

  • Loading branch information...
1 parent e062e06 commit 1b83254365b07a3a0e4e14a7d7b611af9a9d91ee @lukebaker lukebaker committed Nov 26, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/munge_and_notify_job.rb
View
2 lib/munge_and_notify_job.rb
@@ -144,7 +144,7 @@ def perform
row << ['Hashed IP Address', Digest::MD5.hexdigest([user_session.ip_addr, APP_CONFIG[:IP_ADDR_HASH_SALT]].join(""))]
# we've had some referrers be UTF-8, rest of CSV is ASCII-8BIT
row << ['URL Alias', url_alias.force_encoding('ASCII-8BIT')]
- row << ['User Agent', user_session.user_agent.force_encoding('ASCII-8BIT')]
+ row << ['User Agent', user_session.user_agent.try(:force_encoding, 'ASCII-8BIT')]
# grab most recent referrer from clicks
# that is older than this current vote

0 comments on commit 1b83254

Please sign in to comment.