プロジェクト

全般

プロフィール

Vote #80058

完了

Issue subject may be broken if the subject field in the receiving email is split into multiple lines

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Email receiving_29
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
29
version_id:
151
issue_org_id:
31365
author_id:
332
assigned_to_id:
1
comments:
6
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

When you create issues via email, the subject of the created issue may be broken if the subject field in the original email is split into multiple lines like the following.

Date: Mon, 13 May 2019 13:39:29 +0900
Message-ID: 
Subject: =?utf-8?B?zrHOss6zzrTOtc62zrfOuM65zrrOu868zr3Ovs6/z4DPgc+Cz4PPhM+Fz4bP?=
        =?utf-8?B?h8+Iz4k=?=
From: 
To: 
Content-Type: text/plain

Split bytes subject.

The subject should be decoded like this:

αβγδεζηθικλμνξοπρςστυφχψω

But the subject of the created issue will be the following:

αβγδεζηθικλμνξοπρςστυφ��ψω

This is due to the bug of mail gem (I tested in 2.7.1).

irb(main):001:0> puts Mail.read('/tmp/split-bytes-subject.eml').subject
αβγδεζηθικλμνξοπρςστυφ��ψω
=> nil

The subject is not split at the boundary between characters but in the middle of bytes that composes a character and mail gem that parses emails does not properly handle such emails. The first line of the decoded subject field is "αβγδεζηθικλμνξοπρςστυφ\xCF" and the second line is "\x87ψω". The character "χ" is consists of two bytes 0xCF and 0x87. These two bytes span two lines. mail gem cannot handle such cases.


journals

The subject seems to be broken because "Mail::SubjectField":https://github.com/mikel/mail/blob/2.7.1/lib/mail/fields/subject_field.rb does not combine multiple lines of subjects into one line.

I created a monkey patch for @Mail::SubjectField@ .

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
I hope to include the workaround in 4.0.4 or 4.1.0.

Fundamentally, mail gem should be fixed and monkey patching in Redmine is not an ideal solution.

However, I think the workaround is beneficial for users who are affected by this problem. Especially East Asian people such as Japanese, Chinese, and Korean are more affected by the issue because they heavily use multi-byte characters in emails.
--------------------------------------------------------------------------------
Setting the target version to 4.0.4.
--------------------------------------------------------------------------------
Patch committed, thanks!
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------


related_issues

relates,Confirmed,31582,Issue subject may be truncated if the subject field in the receiving email is split into multiple lines in singlebytes and multibytes mixed

Admin Redmine さんが約4年前に更新

  • カテゴリEmail receiving_29 にセット
  • 対象バージョン4.0.4_151 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0