Fixes #2325 - remove blockquote blocks before checking if attachment is referenced in message.

This commit is contained in:
Denny Bresch 2019-07-26 16:44:30 +02:00 committed by Thorsten Eckel
parent 1b7140bb1d
commit ec8b7b5be1
2 changed files with 11 additions and 2 deletions

View file

@ -821,12 +821,16 @@ class App.Utils
# en
attachmentTranslatedRegExp = new RegExp("\\W#{word}\\W", 'i')
return word if message.match(attachmentTranslatedRegExp)
# remove blockquote, check only the unquoted content
return word if message.replace(/(<blockquote>.*<\/blockquote>)/g, "").match(attachmentTranslatedRegExp)
# user locale
attachmentTranslated = App.i18n.translateContent(word)
attachmentTranslatedRegExp = new RegExp("\\W#{attachmentTranslated}\\W", 'i')
return attachmentTranslated if message.match(attachmentTranslatedRegExp)
# remove blockquote, check only the unquoted content
return attachmentTranslated if message.replace(/(<blockquote>.*<\/blockquote>)/g, "").match(attachmentTranslatedRegExp)
false
# human readable file size

View file

@ -1281,6 +1281,11 @@ test("check check attachment reference", function() {
result = 'Enclosed'
verify = App.Utils.checkAttachmentReference(message)
equal(verify, result)
message = '<div>Hi Test,</div><div><blockquote>On Monday, 22 July 2019, 14:07:54, Test User wrote:<br><br>Test attachment<br></blockquote></div>'
result = false
verify = App.Utils.checkAttachmentReference(message)
equal(verify, result)
});
// replace tags