From 71ddec6c31a89d7b672f1827a2d87aea10c019f5 Mon Sep 17 00:00:00 2001 From: Alex Legler Date: Mon, 29 Jun 2015 21:44:54 +0200 Subject: Fix broken names when no realname is set in From: This should avoid further 'Encoding could not be reliably detected' errors for messages with 'From: addr@dom.ain' headers. --- lib/utils.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/utils.rb b/lib/utils.rb index cc9fd46..e3a4836 100644 --- a/lib/utils.rb +++ b/lib/utils.rb @@ -61,7 +61,10 @@ module Ag def get_sender_displayname(message) begin - fix_encoding(message[:from].addrs.first.display_name).strip + display_name = message[:from].addrs.first.display_name + display_name ||= message[:from].addrs.first.to_s + + fix_encoding(display_name).strip rescue NoMethodError fix_encoding(message[:from].to_s).strip end -- cgit v1.2.3-65-gdbad