Fixes #2325 - remove blockquote blocks before checking if attachment is referenced in message.
This commit is contained in:
parent
1b7140bb1d
commit
ec8b7b5be1
2 changed files with 11 additions and 2 deletions
|
@ -821,12 +821,16 @@ class App.Utils
|
||||||
|
|
||||||
# en
|
# en
|
||||||
attachmentTranslatedRegExp = new RegExp("\\W#{word}\\W", 'i')
|
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
|
# user locale
|
||||||
attachmentTranslated = App.i18n.translateContent(word)
|
attachmentTranslated = App.i18n.translateContent(word)
|
||||||
attachmentTranslatedRegExp = new RegExp("\\W#{attachmentTranslated}\\W", 'i')
|
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
|
false
|
||||||
|
|
||||||
# human readable file size
|
# human readable file size
|
||||||
|
|
|
@ -1281,6 +1281,11 @@ test("check check attachment reference", function() {
|
||||||
result = 'Enclosed'
|
result = 'Enclosed'
|
||||||
verify = App.Utils.checkAttachmentReference(message)
|
verify = App.Utils.checkAttachmentReference(message)
|
||||||
equal(verify, result)
|
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
|
// replace tags
|
||||||
|
|
Loading…
Reference in a new issue