Ignore <img src="cid:..."> in forward-email text field (fixes #2305)

This commit is contained in:
Ryan Lue 2018-10-29 16:18:03 +08:00
parent 96eaac4771
commit fc9b8de922
2 changed files with 6 additions and 1 deletions

View file

@ -1146,7 +1146,7 @@ class App.Utils
html.find('img').each( (index) -> html.find('img').each( (index) ->
src = $(@).attr('src') src = $(@).attr('src')
if !src.match(/^data:/i) if !src.match(/^(data|cid):/i) # <img src="cid: ..."> may mean broken emails (see issue #2305)
base64 = App.Utils._htmlImage2DataUrl(@) base64 = App.Utils._htmlImage2DataUrl(@)
$(@).attr('src', base64) $(@).attr('src', base64)
) )

View file

@ -3079,6 +3079,11 @@ test("htmlImage2DataUrl", function() {
result = App.Utils.htmlImage2DataUrl(source) result = App.Utils.htmlImage2DataUrl(source)
equal(result, should, source) equal(result, should, source)
source = '<img src="cid:1234">some test'
should = '<img src="cid:1234">some test'
result = App.Utils.htmlImage2DataUrl(source)
equal(result, should, source)
}); });
source = '<img src="/assets/images/avatar-bg.png">some test' source = '<img src="/assets/images/avatar-bg.png">some test'