commit: 71ddec6c31a89d7b672f1827a2d87aea10c019f5
Author: Alex Legler <alex <AT> a3li <DOT> li>
AuthorDate: Mon Jun 29 19:44:54 2015 +0000
Commit: Alex Legler <a3li <AT> gentoo <DOT> org>
CommitDate: Mon Jun 29 19:44:54 2015 +0000
URL: https://gitweb.gentoo.org/proj/ag.git/commit/?id=71ddec6c
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 <AT> 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