Fixes #3571 - Invalid html signature detection for exchange warning boxes.

This commit is contained in:
Rolf Schmidt 2021-05-26 08:46:59 +00:00 committed by Thorsten Eckel
parent a1187c218a
commit 85856cbd40
2 changed files with 13 additions and 0 deletions

View file

@ -795,6 +795,9 @@ class App.Utils
try content = $('<div/>').html(message) try content = $('<div/>').html(message)
catch e then content = $('<div/>').html('<div>' + message + '</div>') catch e then content = $('<div/>').html('<div>' + message + '</div>')
# ignore mail structures of case Ticket#1085048
return message if content.find("div:first span:contains('CAUTION:')").css('color') == 'rgb(156, 101, 0)'
content.contents().each (index, node) -> content.contents().each (index, node) ->
text = $(node).text() text = $(node).text()
if node.nodeType == Node.TEXT_NODE if node.nodeType == Node.TEXT_NODE

View file

@ -1083,6 +1083,12 @@ test("identify signature by HTML", function() {
result = App.Utils.signatureIdentifyByHtml(message) result = App.Utils.signatureIdentifyByHtml(message)
equal(result, should) equal(result, should)
// ignore mail structures of case Ticket#1085048
message = '<div><span style="color:#9c6500;">CAUTION:</span> This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.</div><br><div><p>actual content</p><div><p>actual content 2</p></div><p>&nbsp;</p><div><p>actual quote</p></div><div><blockquote><p>actual quote</p></blockquote></div><div><p>&nbsp;</p></div><p>&nbsp;</p></div></div>'
should = '<div><span style="color:#9c6500;">CAUTION:</span> This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.</div><br><div><p>actual content</p><div><p>actual content 2</p></div><p>&nbsp;</p><div><p>actual quote</p></div><div><blockquote><p>actual quote</p></blockquote></div><div><p>&nbsp;</p></div><p>&nbsp;</p></div></div>'
result = App.Utils.signatureIdentifyByHtml(message)
equal(result, should)
// Gmail via Safari on MacOS 10.12 // Gmail via Safari on MacOS 10.12
message = '<div dir="ltr">Reply with <b>gmail</b> via Safari on MacOS 10.12</div><br>\ message = '<div dir="ltr">Reply with <b>gmail</b> via Safari on MacOS 10.12</div><br>\
<div>\ <div>\
@ -3303,6 +3309,8 @@ App.Utils.htmlImage2DataUrlAsyncInline($('#image2data2'), {success: htmlImage2Da
} }
test('App.Utils.baseUrl()', function() { test('App.Utils.baseUrl()', function() {
configGetBackup = App.Config.get
// When FQDN is undefined or null, // When FQDN is undefined or null,
// expect @baseUrl() to return window.location.origin // expect @baseUrl() to return window.location.origin
App.Config.get = function(key) { return undefined } App.Config.get = function(key) { return undefined }
@ -3338,6 +3346,8 @@ test('App.Utils.baseUrl()', function() {
} }
} }
equal(App.Utils.baseUrl(), 'http://bar.zammad.com', 'with any other FQDN (and http scheme)') equal(App.Utils.baseUrl(), 'http://bar.zammad.com', 'with any other FQDN (and http scheme)')
App.Config.get = configGetBackup
}); });
test('App.Utils.joinUrlComponents()', function() { test('App.Utils.joinUrlComponents()', function() {