diff --git a/app/models/channel/email_parser.rb b/app/models/channel/email_parser.rb index 994a87dbc..b8b78be9f 100644 --- a/app/models/channel/email_parser.rb +++ b/app/models/channel/email_parser.rb @@ -144,6 +144,11 @@ class Channel::EmailParser data[:from_display_name].gsub!(/^'/, '') data[:from_display_name].gsub!(/'$/, '') + # do extra encoding (see issue#1045) + if data[:subject].present? + data[:subject].sub!(/^=\?us-ascii\?Q\?(.+)\?=$/, '\1') + end + # compat headers data[:message_id] = data['message-id'.to_sym] diff --git a/test/fixtures/mail50.box b/test/fixtures/mail50.box new file mode 100644 index 000000000..784269cea --- /dev/null +++ b/test/fixtures/mail50.box @@ -0,0 +1,22 @@ +From martin@example.com Thu May 3 12:04:29 2012 +Return-Path: +X-Original-To: info@example.com +Delivered-To: box@samba.example.com +Received: from me.home (1-2-1-1.adsl.highway.example.com [1.2.1.1]) + by samba.example.com (Postfix) with ESMTPSA id C96F8500D3D + for ; Thu, 3 May 2012 12:04:28 +0100 (BST) +Subject: =?us-ascii?Q?ABC / 123 / Wetterau West / ABC?= +From: +Content-Type: text/plain; + charset=iso-8859-1 +Content-Transfer-Encoding: quoted-printable +Date: Fri, 4 May 2012 14:01:03 +0200 +Message-Id: +To: metest@znuny.com + +=E4=F6=FC=DF ad asd + +-Martin + +-- +Old programmers never die. They just branch to a new address. diff --git a/test/unit/email_parser_test.rb b/test/unit/email_parser_test.rb index b3f4ffef3..c2a918a81 100644 --- a/test/unit/email_parser_test.rb +++ b/test/unit/email_parser_test.rb @@ -1039,6 +1039,14 @@ end
", }, }, + { + data: IO.binread('test/fixtures/mail50.box'), + body_md5: '154c7d3ae7b94f99589df62882841b08', + attachments: [], + params: { + subject: 'ABC / 123 / Wetterau West / ABC', + }, + }, { data: IO.binread('test/fixtures/mail51.box'), body_md5: '64675a479f80a674eb7c08e385c3622a',