From 1b83254365b07a3a0e4e14a7d7b611af9a9d91ee Mon Sep 17 00:00:00 2001 From: Luke Baker Date: Tue, 26 Nov 2013 10:26:17 -0500 Subject: [PATCH] add .try() when force_encoding on user-agent --- lib/munge_and_notify_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/munge_and_notify_job.rb b/lib/munge_and_notify_job.rb index 4027a6c75..19f4444cc 100644 --- a/lib/munge_and_notify_job.rb +++ b/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