プロジェクト

全般

プロフィール

Vote #75508

完了

Body delimiters to truncate emails do not take uncommon whitespace into account

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

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

0%

予定工数:
category_id:
29
version_id:
119
issue_org_id:
17718
author_id:
2784
assigned_to_id:
0
comments:
7
status_id:
5
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

The function which truncate emails after a certain delimiter was found (i.e. @MailHandler#cleanup_body@) currently does not take trailing whitespace into account that is not part of @\s@. This e.g. includes non-breaking spaces which are common after e.g. signature delimiters (hyphen hyphen no-break-space).

This results in delimiters being not taken into account if there are these unicode whitespace characters at the end of the line.

The attached patch fixes this for Ruby versions >= 1.9. I have found no generally reliable way to fix this for Ruby 1.8 which thus retains the previous behavior. The reason this only works on Ruby >= 1.9 is that only this version includes a possibility to match unicode whitespace. Ruby 1.8 only has a limited list of ASCII characters ("against the unicode spec apparently":http://stackoverflow.com/a/4981864).

Given that I can't change the behavior on 1.8, this change is unfortunately rather difficult to test. I have also attached a patch with improved tests which work properly on 1.9 and 2.0 but breaks on 1.8 as it doesn't recognize the change in behavior. Given that, I'd rather prefer to pull the improvement of behavior without the test than to hold everything out...


journals

Thank you, Holger!
--------------------------------------------------------------------------------

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

--------------------------------------------------------------------------------
Current versions of Redmine don't support Ruby 1.8 (#14371).
I think the rebased version of the patch can be merged into Redmine core.
--------------------------------------------------------------------------------
Updated Holger Just first patch to apply cleanly.
--------------------------------------------------------------------------------
Thank you for fixing the patch. Now we can apply attachment:0001-Allow-unicode-whitespace-after-mail-handler-body-del_r16545.patch and attachment:0002-Add-test-for-trailing-unicode-whitespace-after-email.patch to the current trunk.
Setting target version to 3.4.0.
--------------------------------------------------------------------------------
Committed in trunk, thanks.
--------------------------------------------------------------------------------

Admin Redmine さんが4年以上前に更新

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

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

いいね!0
いいね!0