プロジェクト

全般

プロフィール

Vote #79994

完了

Text may unexpectedly be enclosed in pre tags when an issue is created via HTML email

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

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

0%

予定工数:
category_id:
29
version_id:
127
issue_org_id:
31232
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]

説明

You sometimes see unexpected pre blocks if you create an issue by sending an HTML email. Please see the example below.

[Input]

foo

bar

[Expected]
!{width: 220px; border: 1px solid #ccc;}.expected-result@2x.png!

[Actual]
!{width: 220px; border: 1px solid #ccc;}.actual-result@2x.png!

This can be fixed by stripping preceding whitespaces from each line in the HTML.


diff --git a/lib/redmine/wiki_formatting/html_parser.rb b/lib/redmine/wiki_formatting/html_parser.rb
index 62445ff3b..b3b45f590 100644
--- a/lib/redmine/wiki_formatting/html_parser.rb
+++ b/lib/redmine/wiki_formatting/html_parser.rb
@@ -30,7 +30,7 @@ module Redmine
       }
 
       def self.to_text(html)
-        html = html.gsub(/[\n\r]/, '').squeeze(' ')
+        html = html.gsub(/^\s+/, '').tr("\n\r", '').squeeze(' ')
     
         doc = Loofah.document(html)
         doc.scrub!(WikiTags.new(tags))

journals

Here is a patch with test code.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Fixed some issues in the patch.
--------------------------------------------------------------------------------

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

--------------------------------------------------------------------------------
Committed, thanks.
--------------------------------------------------------------------------------


related_issues

blocks,Closed,31231,Better handling of HTML tables when creating an issue from an email

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

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

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

いいね!0
いいね!0