diff options
author | Alex Legler <alex@a3li.li> | 2015-06-29 21:44:54 +0200 |
---|---|---|
committer | Alex Legler <alex@a3li.li> | 2015-06-29 21:44:54 +0200 |
commit | 71ddec6c31a89d7b672f1827a2d87aea10c019f5 (patch) | |
tree | fce46713cb6706a7624231450aa7e403a256ee00 | |
parent | Clarify error message (diff) | |
download | backend-71ddec6c31a89d7b672f1827a2d87aea10c019f5.tar.gz backend-71ddec6c31a89d7b672f1827a2d87aea10c019f5.tar.bz2 backend-71ddec6c31a89d7b672f1827a2d87aea10c019f5.zip |
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.
-rw-r--r-- | lib/utils.rb | 5 |
1 files changed, 4 insertions, 1 deletions
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 |