Fixes #4112 - Zammad shows "<![if !supportLists]>- <![endif]>" instead of list icon

This commit is contained in:
Florian Liebe 2022-06-20 16:52:52 +02:00
parent 74c7a6b5f6
commit f7f1068bf0
2 changed files with 17 additions and 0 deletions

View file

@ -349,6 +349,9 @@ class String
string.gsub!(%r{[[:space:]]*(<br(|/)>[[:space:]]*)*\Z}i, '')
string.gsub!(%r{(<p></p>){1,10}\Z}i, '')
# https://github.com/zammad/zammad/issues/4112
string.gsub!(%r{&lt;!\[if !supportLists\]&gt;.+?&lt;!\[endif\]&gt;}, '• ')
string.signature_identify('html')
marker_template = '<span class="js-signatureMarker"></span>'

View file

@ -1430,6 +1430,20 @@ RSpec.describe String do
<li><a href="http://business-catalogs.example.com/ODtpbGs5MWIzbjUyYzExLTA4Yy06Mmg7N3AvL3R0bmFvY3B0LXlhbW9sc2Nhb3NnYy5lL3RpbXJlZi9lbS9ycnJuaWFpZXMsdGxnY25pLGUsdXJ0b3NVTGVpNWZ8fGZh" rel="nofollow noreferrer noopener" target="_blank" title="http://business-catalogs.example.com/ODtpbGs5MWIzbjUyYzExLTA4Yy06Mmg7N3AvL3R0bmFvY3B0LXlhbW9sc2Nhb3NnYy5lL3RpbXJlZi9lbS9ycnJuaWFpZXMsdGxnY25pLGUsdXJ0b3NVTGVpNWZ8fGZh">Luxemburg</a></li>
TEXT
end
# https://github.com/zammad/zammad/issues/4112
it 'converts lists from MS Outlook correctly' do
expect(<<~HTML.chomp.html2html_strict).to eq(<<~TEXT.chomp)
<p class="MsoPlainText" style="margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo1">
<![if !supportLists]><span style="font-family:Symbol;mso-fareast-language:EN-US"><span style="mso-list:Ignore">·<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span style="mso-fareast-language:EN-US">1<o:p></o:p></span></p>
<p class="MsoPlainText" style="margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo1">
<![if !supportLists]><span style="font-family:Symbol;mso-fareast-language:EN-US"><span style="mso-list:Ignore">·<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span style="mso-fareast-language:EN-US">2<o:p></o:p></span></p>
HTML
<p> 1</p><p>• 2</p>
TEXT
end
end
context 'signature recognition' do