Actions
Defect #31232
closedText may unexpectedly be enclosed in pre tags when an issue is created via HTML email
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Affected version:
Description
You sometimes see unexpected pre blocks if you create an issue by sending an HTML email. Please see the example below.
[Input]
<div>foo</div> <p> bar </p>
[Expected]
[Actual]
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))
Files
Related issues
Updated by Go MAEDA over 5 years ago
- File fix-31232.patch fix-31232.patch added
Here is a patch with test code.
Updated by Go MAEDA over 5 years ago
- Blocks Feature #31231: Better handling of HTML tables when creating an issue from an email added
Updated by Go MAEDA over 5 years ago
- File fix-31232-v2.patch fix-31232-v2.patch added
- Subject changed from Some text is unexpectedly enclosed in pre tags when creating an issue via HTML email to Text may be unexpectedly enclosed in pre tags when an issue is created via HTML email
Fixed some issues in the patch.
Updated by Go MAEDA over 5 years ago
- File fix-31232-v3.patch fix-31232-v3.patch added
Updated by Go MAEDA over 5 years ago
- Subject changed from Text may be unexpectedly enclosed in pre tags when an issue is created via HTML email to Text may unexpectedly be enclosed in pre tags when an issue is created via HTML email
- Target version changed from Candidate for next major release to 4.1.0
Updated by Jean-Philippe Lang over 5 years ago
- Status changed from New to Closed
- Assignee set to Jean-Philippe Lang
- Resolution set to Fixed
Committed, thanks.
Actions